Deploying-a-Simple-Application_thumb[1]_thumb[2]

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

Introduction
Part 1: Setting Up a SQL Azure Server and Database
Part 2: Scripting the On-Premise Database for SQL Azure
Part 3: Executing the Scripts on the SQL Azure Database
Part 4: Creating the Cloud Solution
Part 5: Testing Locally
Part 6: Preparing the Deployment Package

A Windows Azure solution is contained in a hosted service. Before deploying the the package we previously created, we’ll have to create the hosted service.

Creating the Hosted Service

  1. In the Windows Azure Management Portal, click on Hosted Services, Storage & CDN in the left-hand menu. From here, you can see all instances of roles that have been provisioned in your Windows Azure subscription. 

    image
  2. Click on New Hosted Service in the toolbar.

    image

  3. Give the service a name. Let’s call it Nerd Dinner.
  4. We need to give the solution a URL prefix under the cloudapp.net domain. Choose a unique prefix. The portal will validate the prefix let you know if it is not available.
  5. Now choose a region from the region dropdown where the solution will be hosted. We created the database in the North Central US region, so let’s do the same for the hosted service.
  6. Keep the Deploy to stage environment option selected.
  7. Give the deployment a name (e.g. Nerd Diner v1.0).
  8. Click on Browse Locally under Package location. Locate the folder to which Visual Studio published the service package and configuration file and select the NerdDinnerCloud package file. Click OK.
  9. Click on Browse Locally under Configuration file. Locate the same folder as the previous step and select ServiceConfiguration.cscfg.  Click OK.
  10. 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.
  11. Windows Azure will now provision the instances. You can follow the provisioning status from the portal.

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

    image

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 a very long DNS name – that’s the DNS name that was created for your staging environment.

    Why is the DNS name different than the one you provided when the hosted service was created? That name (URL prefix) is reserved for the production environment.

  3. Launch the solution by clicking on the DNS name.  Test the application to make sure that everything is working similar to the test done in part 5

After you’ve tested the solution in the staging environment, there is only one task left to do – promote the solution to the production environment.