Pages

Wednesday, 18 March 2015

Creating and Configuring a Microsoft Azure Website with a Custom Domain

Microsoft Azure offers a full PaaS (Platform as a Service) for web sites and applications. This should not be confused with Virtual Machines hosted in Azure, running the Internet Information Services (IIS) role to host websites. Microsoft Azure Websites are fully managed instances.
To create a new Azure Website instance you can use the Management Portal or PowerShell from the Azure SDK.
When you create an Azure Website you must specify a region where the instance should be provisioned, you must also give it a globally unique name.
This command outputs all the available regions to the subscription.
Get-AzureWebsiteLocation


This command checks the proposed name of your website is globally unique across Azure.

Test-AzureName –Website “Website”


The following Azure PowerShell command will create a web instance, the first two commands are to set variables that are called by the command itself.
$wsLocation = “West Europe”
$wsName = “MyNewWebsite01316698339”
New-AzureWebsite –Location $wsLocation –Name $wsName



When you return to the Management Portal, and click on Websites you should see the newly created website instance. To configure a Custom Domain you would normally click on Manage Domains, but it maybe greyed out for you like below.

This is because Custom Domains are not supported on the Free Trial website instances, therefore you must change the Web Hosting Plan Mode to either Basic or Standard. You can do this by click on the website, and then clicking on Scale. From here you click on the options under Web Hosting Plan Mode. Remember to Save the configuration using the Save icon.


When you return to the Websites pane, and you highlight the website the Manage Domains button should not be highlighted.


Click Manage Domains, this is where you find out what IPv4 address your new website instance is using in this example its 104.40.210.25, this is required when reconfiguring your public DNS.

You must create a couple of DNS records on your public DNS, the first can be an (A) record which is used to redirect clients connecting to your site to the Azure website, this is like a traditional website DNS name mapped to corresponding hosting IP.
The second is a CNAM record which is used by Azure to verify that you are the rightful owner of the domain you are configuring.
Your external DNS should have records configured like below;
Domain Name (ryanbetts.co.uk fort example) (A) Record > 104.40.210.25 (your Azure public IP)
awverify.domain.co.uk (CNAME) Record > awverify.websiteinstancename.azurewebsites.net
Once the external DNS configurations are in place return to the Manage Custom Domains and enter your domain under Domain Names, this will lookup DNS and verify the CNAME is in place to authenticate you. It will also associate the external domain with the Azure website.

Now if you browse to the website, using the external FQDN and the alias you should see an Azure Web Sites page, as nothing has been uploaded it will show an Error 404 on screen.