Microsoft has announced that Cloud Services (classic) will be retired on 31 August 2024. Their recommendation is to move to a new deployment model based on ARM called Cloud Services (extended support).
While many things remain the same in the new deployment model, there is one notable and major difference – Cloud Service resources no longer have Production and Staging slots. Instead, one Cloud Service resource can be tagged as “swappable” with another Cloud Service resource, and then the Public IP Address and associated DNS name is swapped between the two resources. This allows one resource to act as Staging, and then be “swapped” into Production.
I’ve created a small tutorial that will walk you through creating a new Cloud Services (extended support) deployment from scratch using the point-and-click UI in the Azure Portal. A future post will explain how to update it using a linked “swappable” Cloud Service resource.
Before you get started following this guide, I recommend looking into moving to App Services or Kubernetes instead. I have doubts about Microsoft’s support of Cloud Services (extended support) -they do not market it, and in Visual Studio, it is limited to working with .NET Framework, not Core/NET5+. It may be worth your time to move completely away from this deployment model.
Creating a Cloud Service Project
Ensure Visual Studio has the tooling enabled
The first thing required is to set up the tooling in Visual Studio. I’m using Visual Studio 2022, but this should work in any version of Visual Studio that still supports Azure Tools 2.9. In the Visual Studio Installer, select Azure development and make sure that the Azure Cloud Services tools option is also selected.
I also have ASP.NET and web development selected because I will be hosting an ASP.NET-based application on the Cloud Service. If you want to follow along, ensure you have this selected as well.
Let the installer set everything up and then open Visual Studio.
Create a new project in Visual Studio
In Visual Studio, select the option to Create a new project and then find Azure Cloud Service (extended support) in the list of templates. Select it and click Next.
On the next window, give your project and solution a name, select where you want to store the solution, select the framework and click Create.
A window will appear asking you to select the roles you want to use. To keep things simple, I’m only going to select on WebRole for this project. Click OK to continue.
Next, you will have to select the type of application you want to create. I selected MVC without Authentication to keep things simple. Web Forms would also be a good choice for demonstration purposes, but I am more comfortable with the MVC pattern so I have gone with it. Set your options and click Create to continue.
Once Visual Studio has set everything up, you should be able to click on the Start Debugging shortcut with the Web Server project set to see the project running within the Compute Emulator and using Azurite for storage.
If you want to see the Compute Emulator UI, look in the Taskbar for the Compute Emulator icon, right-click it and select Show Computer Emulator UI.
You should see something like the following:
Deploying the new Cloud Service (extended support) resource to Azure using the portal
Deploying to Azure
Navigate to the Azure Portal and sign in. If you do not have a paid Azure subscription, you will need to first create one before you can continue.
Create a storage account
You need an Azure Storage account to upload the Cloud Service deployment files. When deploying the Cloud Service, it will only read the deployment files from the Azure storage account. You can select the files directly from your local system, but you will then have to select an Azure Storage account container to which the files will be uploaded.
Create a virtual network
The Cloud Service requires a virtual network with an assigned subnet for the virtual machines. This can be created automatically when you first deploy the Cloud Service, but you can configure it yourself if you first create it before doing the deployment.
In the Azure portal, select Create a resource and then search for Virtual network. Select the option from Microsoft and then click Create.
Make sure to place it in the same Resource group where the Cloud Service will exist. Select the Subscription, Resource group, Name and Region of the virtual network, then click Next : IP Addresses.
Keep clicking next, through all the settings and configure them as required. I left them all on default. On the IP Addresses tab, take note of the subnet name. You might want to declare different subnets for various web and worker roles, but for this demonstration, I am using default for everything.
Next, open the ServiceConfiguration.Cloud.cscfg file and update it with the virtual network and subnet details.
Create a public IP address
The Cloud Service needs a Public IP address assigned so that it can be reachable over the Internet. 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. 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.
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. 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, 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.
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.
If you navigate to this, you should see your application running.