Retain a constant virtual IP address for an Azure cloud service
Note
This article applies to Azure Cloud Services (classic), which is now deprecated for new customers and will be retired on August 31, 2024. Existing services built with this technology are still supported through Azure Cloud Services (extended support). For new development, we recommend that you use a newer service type designed for your specific purpose, such as Azure App Service, Azure Functions, or Azure Container Apps. For the latest list of available services, see Directory of Azure products.
When you update a cloud service that's hosted in Azure, you might need to ensure that the virtual IP (VIP) address (VIP) of the service doesn't change. Many domain management services use the Domain Name System (DNS) for registering domain names. DNS works only if the VIP remains the same. You can use the Publish Wizard in Azure Tools to ensure that the VIP of your cloud service doesn't change when you update it. For more information about how to use DNS domain management for cloud services, see Configuring a custom domain name for an Azure cloud service.
Prerequisites
- An Azure account. If you don't have an Azure account, activate your Azure benefits for Visual Studio subscribers or sign up for a free trial.
Publish a cloud service without changing its VIP
The VIP of a cloud service is allocated when you first deploy it to Azure in a particular environment, such as the production environment. The VIP changes only if you delete the deployment explicitly or the deployment is implicitly deleted by the deployment update process. To retain the VIP, you must not delete your deployment, and you must make sure that Visual Studio doesn't delete your deployment automatically.
You can specify deployment settings in the Publish Wizard, which supports several deployment options. You can specify a fresh deployment or an update deployment, which can be incremental or simultaneous. Both kinds of update deployment retain the VIP. For definitions of these different types of deployment, see Publish Azure Application Wizard. In addition, you can control whether the previous deployment of a cloud service is deleted if an error occurs. If you don't set that option correctly, the VIP might change unexpectedly.
Update a cloud service without changing its VIP
Create or open an Azure cloud service project in Visual Studio.
In Solution Explorer, right-click the project. On the shortcut menu, select Publish.
In the Publish Azure Application dialog box, select the Azure subscription to which you want to deploy. Sign in if necessary, and select Next.
On the Common Settings tab, verify that the name of the cloud service to which you're deploying, the Environment, the Build configuration, and the Service configuration are all correct.
On the Advanced Settings tab, verify that the Deployment label and the Storage account are correct. Verify that the Delete deployment on failure checkbox is cleared, and verify that the Deployment update checkbox is selected. By clearing the Delete deployment on failure checkbox, you ensure that your VIP isn't lost if an error occurs during deployment. By selecting the Deployment update checkbox, you ensure that your deployment isn't deleted and your VIP isn't lost when you republish your application.
To further specify how you want the roles to be updated, select Settings next to Deployment update. Select either Incremental update or Simultaneous update, and select OK. Choose Incremental update to update each instance of your application, one after another, so that the application is always available. Choose Simultaneous update to update all instances of your application at the same time. Simultaneous updating is faster, but your service might not be available during the update process. When you are finished, select Next.
In the Publish Azure Application dialog box, select Next until the Summary page is displayed. Verify your settings, and then select Publish.
Related content
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for