Windows Azure - Part 2 - Publishing to Cloud

In this blog, I will reiterate steps to publish a simple solution to the cloud.
First up, I created a simple website that has a predefined set of quotations and then on the default page, I randomly display a quote. This is very simple because here we are not concerned about the business logic but about how Azure publishing works.

Steps to get ready for publishing from Visual Studio
  • First we need to create an account at windows.azure.com I have a MSDN subscription so I already have an account.
  • Then on the management portal, we create a "new Hosted Service" and set some simple properties such as name and location.
  • Instead of choosing location, it is better to choose an affinity group. An affinity group means that all the servers/VMs will be located in the area that we select as an affinity group.
  • Once this is done, we create a certificate to ensure that only those who have this certificate are allowed to publish.
  • We create this cert in VS by going to server explorer and then right-clicking the Windows Azure Compute tab and selecting "Add Deployment Environment".
  • In this tab, we right click again on "Windows Azure Accounts" and then clicking "New".
  • On this window, we can create a new cert and then in step 2 we can copy the path of this cert to the clipboard. (picture below)
  • Then we go back to the management portal and navigate to "Management Certificates" tab. Here we click the "Add Certificate" button.
  • Here we can copy the path that we copied in the previous step and finish adding the certificate.
  • Once the cert is added, in the management portal on the right side you will see that an subscription ID is generated.
  • Copy this subscription ID and go back to VS and paste the id in step 3. Give this cert some name and click OK.
  • Now go back to Management portal and click on Storage accounts and then click on New Storage account.
  • Create a new storage account by choosing the same affinity group as chosen above. Its not required but its a good practice to have your storage and app VMs to be near to each other.
  • Once this is done, we are all set up to publish our solution.

Publishing
  • Right click on the windows azure project and click on publish.
  • This will open up an window where you have to select the Credentials, Deployment environment and storage account. All of this, we just created in the steps above.
  • Once this is done, click on OK and publishing will start.
  • The publishing takes some time because Azure is actually getting all the instances ready for publishing and then publishing the code out to them.
  • As publishing progresses, VS also shows a Windows Azure Activity Log - which displays status information about publishing. (shown above)
  • Once the publishing is done a website URL is provided for you to access your website.
  • My first cloud app website is located at : http://quotes.cloudapp.net (if you can not access the website, that means, I have brought it down because it costs money to keep it up all the time. So I bring it up only when I am doing some testing for few days. Sorry about that)