Env & configuration for deploying Azure web app using slots

I’ve read this: http://help.octopusdeploy.com/discussions/questions/5783-azure-web-apps-promotion-by-switching-slots.

Is there any more formal docs on octopus 3.1.* and using slots? I couldn’t find any. (When will you be adding slot support for web apps like you have for cloud services?)

For the time being, it looks like I need to use the commandlet, which is fine, but i’d love a little help.

I’m using Octopus Server 3.1.4.
I need to deploy to Azure WebApps and use Slots.
I have 4 sites that need to be deployed at the same time. 1.mydomain.com, 2.mydomain.com, 3.mydomain.com, 4.mydomain.com

Currently I had 2 env. Integration & Production.

To utilize slots, I should create an Env of “Staging” and have the majority of the process steps apply to the Staging Env.

Then have a Production Env, which is basically just the step to switch slots.

Is this correct?

Questions:

  • What sort of Target/s do i put under Production?
  • Where do i use the azure commandlet (Switch-AzureWebSiteSlot)? (Can you provide an example usage)
  • Do i have to do anything to configure the commandlet so it has access all my Azure credentials?

Hi,

Thanks for reaching out. I’ve discussed this with the Team and we decided to create a github issue to investigate how we can add a more robust support for azure web app slots. You can follow its progress over here: https://github.com/OctopusDeploy/Issues/issues/2094

At the current moment, the recommended approach is to use Switch-AzureWebsiteSlot in a separate step scoped to the environment that represents the target slot.

If you don’t want to have a a dedicated server to run the Powershell script, you can turn the Octopus server itself into a Tentacle, assign it some role like scriptrunner and run the Powershell script from it.

Best regards,

Dalmiro

@Dalmiro, i’ll give it a shot.

I currently do have the Octopus Server as a Tentacle.

Do i have to do anything to configure the commandlet so it has access all my Azure credentials? Or do you pre load Subscription Info to all Power Shell scripts?

Perhaps a quick example usage / script?

Basically the only way to use Azure Webapps without down time during deploys is to use slots. All recommendations and best practices welcome.

Hi,

You should actually use the Azure Powershell Script step introduced in 3.0 for this. It will manage the subscription for you (using one of the subscriptions previously mapped to your Octopus instance). All scripts ran using this step will be executed from the Octopus Server box.

Sorry I did not mention this alternative before. This was actually the most accurate way to do what you want to do (until we officially add support for slots)

Thanks!

Dalmiro

Ok. I’ll give that a shot.

Thank you!

-Mark

@Dalmiro,

It looks like the commandlet is available, so perhaps i need to do this:

Where do I do this?

Hi,

The cmdlet should be available from an Azure Powershell Script step. If you run the below Powershell script on an Azure Powershell Script step, what do you see in the Output?

if (Get-Command -Module Azure -Name Switch-AzureWebsiteSlot){
    "The cmdlet [Switch-AzureWebsiteSlot] is available and ready to be used"
}
else{
    "Couldnt find the command"
}

Thanks!

Dalmiro

@Dalmiro,

I got it working running exactly the script here:

as a power shell script.

I’m thinking you guys should add that is checkbox to load in libraries.