0

Hy

We have two app services:

  • RESTService (Azure App Service Web App -> ASP.NET)

  • WebApplication (Azure App Service Web App -> Angular.JS SPA)

The RESTService has a web.config and the WebApplication a appconfig.json as their configuration-file.

On each app service we have a staging-slot, where we would like to do some tests (auto and manual). For that reason, we need to have sticky-slot settings for the web.config and the appconfig.json file. With the sticky-slot settings from the portal, I think this is not possible (these settings only apply to appsettings-configurations in a web.config I think).

What is the best way to do that?

I think of something like that: - In my release-configuration I deploy the web-apps to the staging slots and then do the modifying (adjust the settings for the staging-environment) on the web.config and the appjson.config in a task (power-shell or something similar)...then I can do the auto-tests, if they succeed I undo my changes in the config-files and swap to production. But what is, if I want to do some manual tests and do the swapping in the portal? Than I have to do the undo of the changes by myself...

Is there maybe something like a pre-swap job, which could trigger before swapping?

Thanks for your help,

Peter

Peter Wyss
  • 395
  • 2
  • 16

1 Answers1

0

As I know, it is very easy to do this if you only store the settings in web.config. You only need to select "slot setting" in Azure portal. If you want to do some swap job before swapping, I would suggest you use Microsoft.WindowsAzure.Management.WebSites, the following is the code to swap slots.

var cert = new X509Certificate2();
cert.Import(Convert.FromBase64String("MIIDBjCCAe6gAwIBAgIQbaFn9SASQoFHELar....."));
var _client = new Microsoft.WindowsAzure.Management.WebSites.WebSiteManagementClient(new Microsoft.WindowsAzure.CertificateCloudCredentials("***", cert));
//do somethings.....
client.WebSites.SwapSlots("<web space>", "<website name>", "<source slot name>", "<target slot name>");
Jambor - MSFT
  • 3,175
  • 1
  • 13
  • 16