How to deploy your First Windows Azure application

There are basically two ways to deploy Windows Azure applications to the cloud.

  1. Using the Windows Azure Web Portal.
  2. Using the Windows Azure Management API.

Since this is your first deployment, we will concentrate on option number 1, which better illustrates this process. Having said this, keep in mind that using number 2 is the preferred alternative when it comes to automating this task.

Preparing your solution for deployment


The first step is to “package” the Windows Azure solution by creating a single file with the extension .cspkg, which will contain all the application and configuration files that will be deployed to the cloud. This task can be accomplished by using the command-line tool “cspack”, included with the Windows Azure SDK. Specific instructions and options on how to use it can be found at the MSDN library online help, located here: http://msdn.microsoft.com/en-us/library/windowsazure/gg432988.aspx.

Having said this, there are multiple wizards and wrappers that facilitate this action. The most common one is included with the Visual Studio tools for Windows Azure, and it is as simple as right-clicking on the Windows Azure project and selecting the “Package” option. As you can imagine, this option is using the cspack utility behind the curtains, but without the hassle of having to type all the required options. When this process is complete, a folder with two files will be displayed: the beforementioned .cspkg file, and a configuration file – with the extension .cscfg - that includes different properties and parameters associated with the deployment. Once this process has been completed, the solution can be uploaded to the cloud following the next steps.



1. Sign in to the Windows Azure Portal at http://windows.azure.com.


After signing in, the following screen will be displayed:


2. On the ribbon, click New Hosted Service.


The Create a New Hosted Service dialog box is displayed:


3. The following table describes the values that you enter in the dialog box to deploy your Windows Azure application:

Dialog Box Control

Value

Choose a subscription

Your subscription should be shown. If it is not, select it from the list.

Enter a name for your service

Type a name for the hosted service, such as My new service.

Enter a URL prefix for your service

Type a prefix to create the URL where your production application will be available.

Important: This prefix must be unique among all of the hosted services running on Windows Azure.

Choose a region

Select the region closest to you to ensure the best performance.

Deployment options

Accept the default options of deploying the application to the staging environment and starting the successful deployment.

Deployment name

Enter the name for the deployment, such as My new deployment.

Package location

Browse to the folder where the .cspkg file was created.

Configuration file

Browse to the folder where the ServiceConfiguration.cscfg file was created.


4. Click OK

Depending on the number of instances selected for your deployment, the following warning dialog box might be displayed:


Applications that run in Windows Azure must be scalable to accommodate varying workloads and must be reliable by making an instance of the application always available. To do this, a minimum of two instances of a role should be running. Additional role instances can be started as needed. You can avoid this message by defining the instance count for each role in the ServiceConfiguration.cscfg files as 2 or more. Keep in mind that increasing the number of instances also increases the amount you are billed for compute services.

5. Click Yes to continue. When the application is successfully deployed, you will see your deployment listed with a status of Ready:


6. Click on the deployment to select it.

7. Click the URL for the sample application in the Properties pane. The URL is listed in the DNS name field:


8. Your application will be displayed in your default web browser.

For more information on how to use the Service Management API for deployment purposes, please visit the MSDN Library online help, located at:

http://msdn.microsoft.com/en-us/library/windowsazure/ee460807.aspx.

Also, specific instructions on how to publish directly from Visual Studio can be found here:

http://msdn.microsoft.com/en-us/gg271301.