Using PowerShell with Windows Azure

If you’re working with Windows Azure and want to use PowerShell to perform management tasks you will first need to install and configure Windows Azure PowerShell as per this article “How to install and configure Windows Azure PowerShell“.

  1. Download and install the Microsoft Web Platform Installer
  2. Launch the Microsoft Web Platform Installer
  3. Select the Windows Azure PowerShell and then click install
  4. Launch PowerShell as an Administrator
  5. Type get-help *Azure* to see all the Windows Azure cmdlets – you will be asked to update help
  6. Download your Windows Azure subscription publish settings file by typing Get-AzurePublishSettingsFile or by browsing to the download publish profile page
  7. Save the publish settings file to a directory – in my case I store this alongside my Windows Azure scripts directory that I have synchronised with Dropbox
  8. Import the publish settings file by typing Import-AzurePublishSettingsFile <PathToPublishSettingsFiles>
  9. Check to see that you can are connected to your Windows Azure subscription by entering Get-AzureSubscription which should return information about your subscription.

Here are a couple of useful links to get you started – Windows Azure Management Cmdlets and Windows Azure Script Centre

That’s it – you should now be able to manage Windows Azure using PowerShell.

Pointing external DNS at a Windows Azure hosted Virtual Machine

Update: while the VIP address is guaranteed for the lifetime of the deployment – a customer recently lost their VIP address which resulted in their custom domain name become unresolvable. Whilst this was acceptable as we were still in a phase of testing it did cause me some concern. Why had the VIP address changed without our knowledge – we had not made any configuration changes to causes this.I did some further research and found an article (Using custom domain names with Windows Azure Cloud Service) in the Documentation section on the Windows Azure website were it advised you should use CNAME records and point these to your *.cloudapp.net domain name. I asked the customer to do this and we have been able to use the system since.

This post describes how I configured one of my Windows Azure hosted Virtual Machines with my domain name registrars DNS  – this meant that I could make SharePoint 2013 available using my domain name.

On the virtual machine instances page in the Windows Azure Management Portal (https://manage.windowsazure.com) browse to the virtual machine you want to configure  with your external DNS.

Windows Azure Virtual Machine Dashboard
Windows Azure Virtual Machine Dashboard

On the right in the “Quick Glance” section you will see that a “Public Virtual IP (VIP) Address” is listed (this is shown in the image below but for security purposes I have changed my VIP to 111.111.111.111). The VIP address is the IP address I need to direct my external DNS to.

Virtual Machine Quick Glance information
Virtual Machine Quick Glance information

This VIP address is guaranteed to remain for the deployment of the cloud service – therefore if the deployment is removed the VIP address will no longer be available. Corey Sanders has written a great article on the Windows Azure MSDN blog (http://blogs.msdn.com/b/windowsazure/archive/2011/07/06/windows-azure-deployments-and-the-virtual-ip-address.aspx) where he confirms that the VIP is guaranteed for the lifetime of deployment and provides a great alternative if the virtual machine deployment has to be removed.

 “If that is not possible (e.g. you must delete/deploy), then a little planning beforehand can still help here: just create a new hosted service, update CNAME and A record to new hosted service (but keep old deployment there). Wait 24 hours and it should be safe to delete the older deployment.”

I also decided to add a shorter TTL to my A record just in case the VIP address does ever change for whatever reason and I need to propagate a change quickly. I’m not sure if this is advisable or not and am seeking confirmation on this.

A quick test you can do before making any changes to your DNS is to browse directly to your VIP address (http://111.111.111.111). This in my case took me to the default IIS site however this will depend on your configuration.

IIS 8 default website landing page
IIS 8 default website landing page

After I confirmed that the VIP address was accessible I then proceeded to make changes to my external DNS through my domain registrars control panel – in this example I wanted to point a host record (or an A record) to my virtual machine.