Overview
This post is a continuation of my previous post where I explained how to Create a Cloud Service (Extended Support) Deployment. In this post, I’ll walk you through the steps to update that deployment using another “swappable” Cloud Service resource. If you do not know how to deploy a Cloud Service (Extended Support) resource to Azure, please read through the previous post first.
Create a public IP address
When deploying the second cloud service, it needs to have an IP address assigned. Eventually, this IP address will be swopped with the one currently pointing to the Cloud Service running in Azure, but to do the deployment, it requires its own one. In the new model, each deployment is its own complete resource, so even though one Cloud Service resource can be swopped with another, it can also run completely independently.
The steps to set this up, are the same as before. Create this in the Portal, using the Marketplace. You’ll find it if you search for Public IP address.
When configuring it, ensure the Basic tier is selected (Standard) is unsupported for Cloud Service deployments. Select a static IP address and set a domain name label prefix. Also, ensure that the resource group and location are the same as the virtual network and the one where the Cloud Service will be deployed. You will have to set a different name and DNS name label than what you set for the first cloud service. I usually suffix both of these with -2.
The rest of the settings can be left as default.
Click create to create the Public IP address. Finally, you need to set the IP address in the .cscfg file. I usually comment out the other IP address and then add this IP address as a new XML element. That way it is easy to comment/uncomment the various IP addresses to select which one you want to use.
Package the project
In Visual Studio, right-click on Cloud Service project, and select Package…. This will create the .cspkg, .cscfg and .csdef files that Azure requires to deploy the Cloud Service.
You will see them in a new File Explorer window that opens automatically,
Create the cloud service
Go to the Marketplace and search for Cloud Services (extended support). I had to search the entire string for it to show up. Then click Create and then Cloud Services (extended support). On the page that appears, select your Subscription and Resource group for the deployment. Then give your cloud service a name and select which Region you want it to be deployed to (It must be in the same region as the Cloud Service you want to swap with). Finally, select the Storage account you want the deployment files uploaded to and select them from your file system. Then click Next: Configuration.
On the Basics page that shows up, select the Subscription and Resource Group, give your Cloud Service a name (I used the same as last time with -2 appended), and select the Region. Next, select from local, choose your Storage account and upload the .cspkg, .cscfg, and .csdef you created earlier. Then click Next: Configuration.
If your .cscfg file is set up correctly, you will see your Virtual network, Subnet and Public IP address show up, and the values won’t have the word “new” in them. That would indicate that Azure will create new resources because it didn’t find what you set in the .cscfg file, or there was nothing set in the .cscfg file. You’ll also see that this is the new IP address, not the one used by the other Cloud Service resource.
Select the dropdown box for Swappable cloud service and select the other Cloud Service resource. This is what makes one cloud service resource swappable with another.
Click Review + create to get to the validation page. Once validation has passed, click Create and wait for the deployment to complete. Once the deployment is complete, you will see the DNS name and IP address of the assigned Public IP Address on the Overview page on the Azure Portal. You will also see it has the other Cloud Service listed as the Swappable cloud service.
If you now go to the other Cloud Service, you will see it has this Cloud Service as its Swappable cloud service.
At the top of the blade for either Cloud Service, click Swap and then OK. This will swap the Public IP DNS name and Public IP address between the two cloud services.
When the swap is finished, you’ll see the Public IP DNS name and Public IP address swapped between the two cloud services in the portal. Refreshing the page on the IP address/domain will also show the results from the other cloud service now.
You can now delete the original Cloud Service resource. When you want to deploy your next update, create a new cloud service resource, using the original IP address, and then swap to it, deleting the -2 resource when complete.