Publishing a Cloud Service using the Windows Azure Tools
By using the Windows Azure Tools for Microsoft Visual Studio, you can publish your Windows Azure application directly from Visual Studio. Visual Studio 2010, Visual Studio 2012, and Visual Web Developer support integrated publishing to either the Staging or the Production environment of a cloud service.
Before you can publish a Windows Azure application, you must have a Windows Azure subscription. You must also set up a cloud service and storage account to be used by your application. You can set these up at the Windows Azure Management Portal.
When you publish, you can select the deployment environment for your cloud service. You must also select a storage account that is used to store the application package for deployment. After deployment, the application package is removed from the storage account. For more information about how to set up these services, see Setting Up Services Required to Publish a Cloud Service from Visual Studio.
When you are developing and testing a Windows Azure application, you can use Web Deploy to publish changes incrementally for your web roles. After you publish your application to a deployment environment, Web Deploy lets you deploy changes directly to the virtual machine that is running the web role. You do not have to package and publish your entire Windows Azure application each time you want to update your web role to test out the changes. With this approach you can have your web role changes available in the cloud for testing without waiting to have your application published to a deployment environment.
Web Deploy is not for use in a production environment. To enable Web Deploy, you must install the Windows Azure Tools and the Windows Azure SDK. Refresh from the Microsoft Web Platform Installer 3.0 page of the Microsoft website.
Use the following procedures to publish your Windows Azure application and to update a web role by using Web Deploy:
When you publish your Windows Azure application, you can do one of the following tasks:
Create a service package: You can use this package and the service configuration file to publish your application to a deployment environment from the Management Portal.
Publish your Windows Azure project from Visual Studio: To publish your application directly to Windows Azure, you use the Publish Wizard. For information, see Publish Windows Azure Application Wizard.
To create a service package from Visual Studio
When you are ready to publish your application, open Solution Explorer, open the shortcut menu for the Windows Azure project that contains your roles, and choose Publish.
To create a service package only, follow these steps:
On the shortcut menu for the Windows Azure project, choose Package.
In the Package Windows Azure Application dialog box, choose the service configuration for which you want to create a package, and then choose the build configuration.
(optional) To enable Remote Desktop for the cloud service after you publish it, select the Enable Remote Desktop for all Roles check box, and choose the Settings link to configure Remote Desktop.
For more information, see Using Remote Desktop with Windows Azure Roles.
To create the package, click OK.
File Explorer shows the file location of the newly created package. You can copy this location so that you can use it from the Windows Azure Management Portal.
To publish this package to a deployment environment, you must use this location as the Package location when you create a cloud service and deploy this package to an environment with the Management Portal. For more information, see How to Create a Cloud Service.
(Optional) To cancel the deployment process, right-click the line item in the activity log and point to Cancel and remove. This stops the deployment process and deletes the deployment environment from Windows Azure.
To remove this deployment environment after it has been deployed, you must use the Management Portal.
(Optional) After your role instances have started, Visual Studio automatically shows the deployment environment in the Windows Azure Compute node in Server Explorer. From here you can see the status of the individual role instances. For more information on the Windows Azure Compute Explorer, see Viewing the State of a Cloud Service using Server Explorer.
The following illustration shows the role instances while they are still in the Initializing state:
Web Deploy is not for use in a production environment with Windows Azure. To enable Web Deploy, you must install the Windows Azure Tools and the Windows Azure SDK from the Microsoft Web Installer 3.0 page of the Microsoft website.
These are the requirements to use Web Deploy to update your web role:
For development and testing purposes only: The changes are made directly to the virtual machine where the web role is running. If this virtual machine has to be recycled, the changes are lost because the original package that you published is used to recreate the virtual machine for the role. You must republish your application to get the latest changes for the web role.
Only web roles can be updated: Worker roles cannot be updated. In addition, you cannot update the RoleEntryPoint in web role.cs.
Can only support a single instance of a web role: You cannot have multiple instances of any web role in your deployment environment. However, multiple web roles each with only one instance are supported.
You must enable remote desktop connections: This is required so that Web Deploy can use the user and password to connect to the virtual machine to deploy the changes to the server that’s running Internet Information Services (IIS). In addition, you might need to connect to the virtual machine to add a trusted certificate to IIS on this virtual machine. (This enables the remote connection for IIS that is used by Web Deploy to be secure.)
The following procedure assumes that the Deploy Windows Azure Project dialog box to publish a Windows Azure application appears.
To Enable Web Deploy When You Publish Your Application
To enable the Enable Web Deploy for all Web Roles check box, you must first configure remote desktop connections. For more information, see Using Remote Desktop with Windows Azure Roles.
To enable Web Deploy for all the web roles in your application, select Enable Web Deploy for all Web Roles.
A yellow warning triangle is displayed. Web Deploy uses an untrusted, self-signed certificate by default, which is not recommended for uploading sensitive data. If you need to secure this process for sensitive data, you can add a SSL certificate to be used for Web Deploy connections. This certificate needs to be a trusted certificate. For information about how to do this, see the section To Make Web Deploy Secure later in this topic.
Click OK to publish,
The Windows Azure application is published. The virtual machine that is created has remote connections enabled for IIS so that Web Deploy can be used to update your web roles without republishing.
If you have more than one instance configured for a web role, a warning message is displayed that each web role will be limited to one instance only in the package that’s created to publish your application. Click OK to continue. As stated in the Requirements section, you can have more than one web role but only one instance of each role.
To Update Your Web Role by Using Web Deploy
To use Web Deploy, you must make code changes to the project for any of your web roles in Visual Studio that you want to publish. Right-click this project node in your solution and point to Publish.
The Publish Web dialog box is displayed.
(Optional) If you added a trusted SSL certificate to use for remote connections for IIS, you can clear the Allow untrusted certificate check box. For information about how to add a certificate to make Web Deploy secure, see the section To Make Web Deploy Secure later in this topic.
To use Web Deploy, the publish mechanism needs the user name and password that you set up for your remote desktop connection when you first published the package.
In User name, type the user name.
In Password, type the password.
(Optional) If you want to save this password in this profile, select Save password.
To publish out the changes to your web role, click Publish.
The status line displays Publish started. When the publishing has completed, Publish succeeded is displayed. The changes have now been deployed to the web role on your virtual machine. Now you can start your Windows Azure application to test out your changes in the Windows Azure environment.
To Make Web Deploy Secure
Web Deploy uses an untrusted, self-signed certificate by default, which is not recommended for uploading sensitive data. If you need to secure this process for sensitive data, you can add a SSL certificate to be used for Web Deploy connections. This certificate needs to be a trusted certificate.
To make Web Deploy secure for each virtual machine for each of your web roles, you must upload the trusted certificate that you want to use for web deploy to the Management Portal. This makes sure that the certificate is added to the virtual machine that is created for the web role when you publish your application.
To add a trusted SSL certificate to IIS to use for remote connections, follow these steps:
To connect to the virtual machine that is running the web role, from the Management Portal, click the instance of the web role in Server Explorer, and then click Connect using Remote Desktop. For the detailed steps about how to connect to the virtual machine, see Using Remote Desktop with Windows Azure Roles.
Your browser will prompt you to download an .RDP file.
To add a SSL certificate, open the management service in IIS Manager. Then, in the Connections group box, click an SSL certificate from the SSL certificate list. For more information, see Configure Connection Settings for the Management Service.
If you add a trusted SSL certificate, the yellow warning triangle no longer appears in the Publish Wizard.