Q: What are the ways to manage virtual machines running in Windows Azure as part of Infrastructure as a Service (IaaS)?
A: With the introduction of Infrastructure as a Service (IaaS) as an offering of Windows Azure, it's now possible to run virtual machines (VMs) as part of your Windows Azure subscription (although at the time this was written, it wasn't released with SLAs but was in preview mode).
You have several different ways to create and manage these VMs. The first way is through the Windows Azure management portal, which allows VMs to be created from the gallery of included templates or from your own uploaded VHD templates.
Once VMs are created, they can be managed and accessed through the web portal as well (access is actually using RDP).
The Windows Azure portal allows only the management of Windows Azure resources. However, many organizations have a mix of on-premises (local virtualization) and off-premises, such as IaaS in Windows Azure.
They use System Center 2012 App Controller, which allows the creation and management of VMs both on-premises via System Center 2012 Virtual Machine Manager (SCVMM) and those in Windows Azure.
As the figure below shows, App Controller exposes much of the same VM management capability as found in the Windows Azure web portal. Additionally App Controller allows a VM in the SCVMM library (local) to be deployed to Windows Azure, which is a great migration feature.
Both App Controller and the Windows Azure web portal are fine for a graphical, manual processm but many organizations will want to interact with Windows Azure in an automated, orchestrated fashion where graphical interfaces aren't a good fit.
In this case, there are two key methods I see many companies using (aside from the various APIs Azure supports for custom solutions). Windows PowerShell is a standard way to perform tasks both from a shell and through a script for Windows, System Center, Exchange, SQL Server, and most other products. Windows Azure also has a PowerShell module that can be downloaded and installed.
Once the PowerShell module is installed, it needs to be imported into the PowerShell session using the command below (assuming installed on a 64-bit OS). You need to ensure your system has been configured to execute remotely signed modules (Set-ExecutionPolicy RemoteSigned):
To look at all the available commands use this command:
Before you can manage the environment, you must first configure your PowerShell session with the Windows Azure subscription you wish to manage. This can be done using the cmdlets
Or you can download the PublishSettings file from the Windows Azure portal and import (see the MSDN documentation) . That basically looks like the following:
The website will open (you will need to be signed in), and you will be prompted to download a file. Save this file--you will use it in the next step. Below you can see the output from my example:
Setting: Windows Azure MSDN - Visual Studio Ultimate as the default and current subscription. To view other subscriptions use Get-A
PS C:\> Get-AzureSubscription
SubscriptionName : Windows Azure MSDN - Visual Studio Ultimate
SubscriptionId : 46xxxxxxxxxxxxxxxxxxxxxxxxxxxxxf8
Certificate : [Subject]
CN=Windows Azure Tools
CN=Windows Azure Tools
11/13/2012 11:29:27 AM
11/13/2013 11:29:27 AM
ServiceEndpoint : https://management.core.windows.net/
IsDefault : True
Also, you will need to set the storage account. The list of available storage accounts can be seen with the cmdlet
then set the account using the command in my example below:
This configuration is stored in
It is then possible to perform any action you need.
The script below creates a basic VM after finding a list of all the available VM images with the Get-AzureVMImage cmdlet. The Windows Azure page also has nice examples on creating VMs with PowerShell, specifically "Create or Delete Virtual Machines" (which also has an example of creating a Linux VM).
Note in the code below that there are multiple images and locations. In my example, the sixth image is Windows 2012, which is what I use--an array location 5 (since the array starts from 0). I'm also using location 0, which is West Europe:
$locations = Get-AzureLocation
$mySvc = "SavillTechTest"
$myPwd = "P@ssw0rd"
New-AzureQuickVM -Windows -name "Sav2012VM" -ImageName $images.imagename -ServiceName $mySvc -Location $locations.Name -Password $myPwd
You should see a succeed message as shown below.
PowerShell can also be used to perform any configuration and to get information about Windows Azure status.
The last option is to use System Center 2012 Orchestrator, which provides a way to connect to basically any aspect of your datacenter and create runbooks--sequences of actions on any connected system. An Integration Pack (IP) is available for Windows Azure which once deployed to Orchestrator using the deployment service adds Azure-specific activities.
Also remember that Orchestrator can use scripts via the System "Run .Net Script" activity. Set the Language to PowerShell, which means any PowerShell script you create for Azure could be used as part of an Orchestrator runbook. The image below shows both the built-in Run .Net Script activity and the various Windows Azure activities that are installed as part of the Azure IP.
I hope this FAQ has given you some idea of the options you have when interacting with Windows Azure IaaS. You might also look at the Windows IT Pro article "Getting Started with Windows Server VMs on Windows Azure IaaS."
See more FAQs at John Savill's page.