With the introduction of Azure Resource Manager (ARM) the world of Infrastructure as a Service (IaaS) inside Azure changed – for the better.
ARM introduced a new way to organize and deploy resources across various aspects of Windows Azure. Now you can create configuration scripts for complex Azure scenarios that include storage, web apps, virtual machines, networks, SQL databases, and more.
With these changes introduced the AzureResourceManager PowerShell module. I could write many posts on this along, but not to get into to many details you now have two ways to do many things in Windows Azure using PowerShell. This gets a little more complex considering additional breaking changes are coming soon when Switch-AzureMode is deprecated and the introduction of both traditional and classic versions of some Azure Artifacts like storage and virtual machines. Going forward I would recommend using AzureResourceManager based PowerShell commands for all new scripts.
Never the less, the way to create a new Virtual Machine is a little more complex now using AzureResourceManager. This is due to the greatly enhanced feature set in Azure that we just did not have a few years ago. As part of these changes, you need to call out your base image disk differently than before. Lets take a look at the two options.
Using Azure Service Manager (ASM – default module in PowerShell right now)
$imageWindows = 'bd507d3a70934695bc2128e3e5a255ba__RightImage-Windows-2012-x64-v13.5' $MyDC = New-AzureVMConfig -name $vmnamePDC -InstanceSize $sizePDC -ImageName $imageWindows
Using Azure Resource Manager (ARM– will be the new default)
$VirtualMachine = Set-AzureVMSourceImage -VM $VirtualMachine -PublisherName 2012-R2-Datacenter -Offer BizTalk-Server -Skus 2013-R2-Developer -Version "latest"
With Azure Service Manger you only need to supply the operating system image name and this can easily be found doing a single PowerShell query. With Azure Resource Manger you need to specify a Publisher Name, Offer, SKU, and Version of the Operating System Azure Image you want to use. It is not as easy or straight forward to get these values.
Below I have put together a quick reference list related to BizTalk Server, SQL Server, and Windows as well as the PowerShell scripts to get these values for any other operating system image.
Enterprise, Standard, Web
Enterprise, Standard, Web *
* some of the SQL SKUs contain other types of optimized versions.
If you want to get the Publisher Name, Offer, and SKU for other Azure Images you can use these PowerShell commands.
# Gets all Publishers in a specific datacenter $locName="West US" Get-AzureVMImagePublisher -Location $locName | Select PublisherName | Select * | Out-Gridview –Passthru
# Gets all Offers for a given Publisher in one location $locName="West US" $pubName="MicrosoftWindowsServer" Get-AzureVMImageOffer -Location $locName -Publisher $pubName | Select Offer | Select * | Out-Gridview –Passthru
# Gets all SKUS for a giving Offer for a given Publisher in one location $locName="West US" $pubName="MicrosoftWindowsServer" $offerName="WindowsServer" Get-AzureVMImageSku -Location $locName -Publisher $pubName -Offer $offerName | Select Skus