Staging an Application in Azure
A packaged application can be deployed to the staging environment in Azure to be tested before you move it to the production environment in which the application is accessible on the Internet. The staging environment is exactly like the production environment, except that you can only access the staged application with an obfuscated URL that is generated by Azure. After you have verified that your application is working correctly, it can be deployed to the production environment by performing a Virtual IP (VIP) swap.
The steps in this article only apply to node applications hosted as an Azure Cloud Service.
Step 1: Stage an Application
This task covers how to stage an application by using the Microsoft Azure PowerShell.
When publishing a service, simply pass the -Slot parameter to the Publish-AzureServiceProject cmdlet.
Publish-AzureServiceProject -Slot staging
Log on to the Azure classic portal and select Cloud Services. After the cloud service is created and the Staging column status has been updated to Running, click on the service name.
Select the Dashboard, and then select Staging.
Note the value in the Site URL entry to the right. The DNS name is an obfuscated internal ID that Azure generated.
Now you can verify that the application is working correctly in the staging environment by using the staging site URL.
Step 2: Upgrade an Application in Production by Swapping VIPs
After you have verified the upgraded version of an application in the staging environment, you can quickly make it available in production by swapping the virtual IPs (VIPs) of the staging and production environments.
This step assumes that you have already deployed an application to production and staged the upgraded version of the application.
- Log into the Azure classic portal, click Cloud Services and then select the service name.
From the Dashboard, select Staging, and then click Swap at the bottom of the page. This opens the VIP Swap dialog.
- Review the information, and then click OK. The two deployments begin updating as the staging deployment switches to production and the production deployment switches to staging.
You have successfully staged a deployment and upgraded a production deployment by swapping VIPs with the deployment in staging.