Friday, March 17, 2017

Finding images in Azure

Microsoft Azure has lots of images available through the marketplace. All of them can be deployed through PowerShell but how do you actually select the right version.

An easy way to do this is by running the following little script. It will query the available images based on the location that you select. Use the box in the prompt to search for the publisher, or version that you are after. It will provide a clear output of the available templates and version. Super simple.

Enjoy!

Script:

#Logon to Azure
Login-AzureRmAccount
#Select your location
$loc = Get-AzureRmLocation | OGV -passthru | select Location
#View the templates available
$publisher=Get-AzureRmVMImagePublisher -Location $loc.Location |OGV -passthru | select publishername #check all the publishers available
$offer=Get-AzureRmVMImageOffer -Location $loc.Location -PublisherName $publisher.PublisherName|OGV -passthru |select offer #look for offers for a publisher
$sku=Get-AzureRmVMImageSku -Location $loc.Location -PublisherName $publisher.PublisherName -Offer $offer.Offer | OGV -passthru |select skus #view SKUs for an offer
Get-AzureRmVMImage -Location $loc.Location -PublisherName $publisher.PublisherName -Offer $offer.Offer -Skus $sku.Skus #Pick one

How does it work?

1. Select the Location you are planning to deploy your virtual machine.


2. Select the Publisher


3. Select the Offer

4. Select the Sku.


5. Review the output and use this in your deployment.





No comments:

Post a Comment