Problems with swapping Azure Cloud Service

The Azure Cloud Service Swapping functionality in Octopus does not seem to work. I have a service and when I deploy I want to:

  • Deploy to Staging
  • Wait until all instances are running
  • Swap Production and Staging
  • Stop or Delete the Staging deployment.

Firstly, it appears that the Staging and Production deployments must have the same deployment label in order to be swapped, which will never happen, because I deploy a new version to Staging.

Secondly, it doesn’t wait until all instances are running, which defeats the purpose because Staging is there to provide a no-downtime deploy.

Thirdly, when I choose to deploy to staging the functionality to inherit the instance count from the existing deployment does not seem to work because it looks at the staging slot (where nothing is deployed) and determines that it has nothing to inherit from. It should pull the Instance Count from the Production deployment, then deploy to Staging with that instance count, then swap.

I found this discussion ( from a couple years ago that suggests that I need to create a Staging and Production environment on my service, but that does not really make sense. Staging and Production are not separate environments. They are the same environment, but they exist to allow us to deploy with no downtime. My current configuration is to have a Test and Prod environment, each with their own set of Cloud Services. I deploy to Test (Deploy To Staging/SwapDelete/Delete Staging) then promote to Prod (Deploy To Staging/SwapDelete/Delete Staging to a different cloud service). Would I really have to have different projects for each environment if I wanted the swapping to work automatically?

Maybe I just need some help understanding how I am supposed to configure my projects. I don’t think I am doing anything that complicated.

Hi Mike,

Thanks for getting in touch! I think there might be some confusion here. For Azure Cloud Services you can either deploy files, or do a swap, but not both in a single deployment process.
The only way we could see this being done is if you had use the current step to deploy to staging then had a Azure PowerShell step that waits for the instance to be running and swaps staging to prod. We have a sample PS script (note this is just a guide, we haven’t put it through full testing).

To have any form of Swap functionality using the Cloud Service feature the following would have to be done.

  • one step that only runs if you are deploying to your “test” environment. It would deploy to the staging slot.
  • one step that only runs if you are deploying to your “prod” environment. It would swap the staging slot into prod.
    It was more designed to use the staging slot as an environment and all in a single process.

Warm Regards,