Deploying a Simple Cloud App: Part 4 - Configuring the Hosted Service, Deploying the Package, and Testing

If you’ve started reading from this post, you’ll need to go through the previous parts of this series before starting this one:

Part 1: Provisioning and Configuring SQL Azure
Part 2: Provisioning a Storage Account
Part 3: Configuring the Service Package 

Deploying-a-Simple-Application_thumb[2]Good new - updating the Service Configuration file with the storage account and database information was probably the most challenging part of the deployment. Now, it’s back to wizard-based tasks.

The Hosted Service is the container of your application in Windows Azure. It breaks down into a deployment and one or more instances of roles required to run your application. In order to run the application, a hosted service is created and the application is deployed into it.

Let’s get started.

Creating a Hosted Service

  1. Log into the Windows Azure Management Portal.

  2. On the top ribbon, click New Hosted Service.


  3. Select the subscription under which you previously provisioned your SQL Azure server, database, and storage account.

  4. In the Service Name field, type a name for this service (e.g. Nerd Dinner). The service name will help you identify this particular service when you you have several services deployed.

  5. In Choose a URL for your service, type a subdomain name to create the URL at which your service will be available.

    This subdomain name must be unique among all the services, yours or anyone else's, running on Windows Azure.

  6. From the region drop down, select North Central US as that is the data centre in which the database and storage accounts reside and will therefore result in optimal performance.

  7. Click on Deploy to stage environment.

    It is recommended that you always deploy to the staging environment first. This will allow you to perform any kind of testing you need on the application prior to it being available for everyone to use.

  8. In the Deployment Name field, enter Nerd Dinner v1.0.

    It is also recommended that you give each deployment a name that describes the package you are deploying, such as a version.

  9. Click on Browse Locally under Package Location and browse to the location on your computer where you saved the deployment package provided by the developers. Select the NerdDinnerCloud.cspkg. Click OK.

    The CSPKG file is an encrypted file that contains all of the files that are required for deploying the application as well as the configuration information required to describe the infrastructure requirements your application needs in order to run.

  10. Click on Browse Locally under Configuration file and select ServiceConfiguration.cscfg. Click OK.

    As discussed previously, the CSCFG file contains additional configuration parameters that require easy access in order to be able to modify as necessary, such as the storage account and database information previously configured or the instance counter.

  11. The service configuration file will now be validated. You’re going to get a warning about only having one instance in your solution. Click Yes to override and submit your solution for provisioning.

  12. Windows Azure will now provision the instances. You can follow the provisioning status from the portal.


  13. After a few minutes, you’ll see the status as Active. Your solution is now deployed in the staging environment.


A service deployed to the staging environment is assigned a URL with the following format: {deploymentid} A service deployed to the production environment is assigned a URL with the following format: {hostedservicename}

You have now successfully deployed the application to the staging environment in Windows Azure. Before going to production, it’s always important to make sure that everything is working as it should.

Testing the Solution in the Staging Environment

  1. From the Hosted Services page, click on Nerd Dinner (the one that is listed as Deployment under the Type column).
  2. In the Properties pane on the right, you’ll see its very long staging environment DNS name. 
  3. Launch the solution by clicking on the DNS name. Test the application to make sure that everything is working.

Let’s go back to our to do list and see what we have to do next.