Sunday, November 25, 2012

Host site on Windows Azure virtual machine

There are several actions which you need to do in order to host your public site on the Windows Azure virtual machine. First of all you need to create your VM instance in Azure panel. You may find many tutorials how to do that, so I won’t repeat it here.

Once you will do that, add Web server role in the Server manager:


If your site is running on ASP.Net 3.5 you have to select it as well as shown on the picture above. Then create site in IIS like you always do and assign host header bindings for you domain name.

Then go to Azure management panel, click on your virtual machine and select Endpoints tab above:


Here you need to add endpoint for http traffic. In order to do that click Add endpoint button below:


When you will create it use the following values: Protocol = TCP, Public port = 80, Private port = 80. At the end you should see the following endpoints in your panel:


After that you need to configure DNS A-record in the DNS editor of your hosting provider. For this you need to know public IP address by which your site will be available. It can be found in Azure panel. Click on your virtual machine and in the Dashboard tab you will find Quick glance panel. On this panel you will see Public virtual IP address:


This is exactly what you need to use for the A-record. According to information from MS (e.g. here: Overview of Managing Deployments in Windows Azure) virtual IP won’t be changed during service lifetime:

Throughout the lifetime of a deployment, the VIP assigned will not change, regardless of the operations on the deployment, including updates, reboots, and reimaging the OS. The VIP for a given deployment will persist until that deployment is deleted. When a customer swaps the VIP between a stage and production deployment in a single hosted service, both deployment VIPs are persisted. A VIP is associated with the deployment and not the hosted service. When a deployment is deleted, the VIP associated with that deployment will return to the pool and be re-assigned accordingly, even if the hosted service is not deleted. Windows Azure currently does not support a customer reserving a VIP outside of the lifetime of a deployment.

After these steps will be done, you need to wait until DNS servers will be updated with new IP. After that you will have your site running on the Windows Azure.

No comments:

Post a Comment