0

How to Add an Azure Image to a VMware vRealize Automation 7.2 (vRA) Blueprint

Azure and vRealize Automation (vRA)

Azure and vRealize Automation (vRA)

With the release of vRealize Automation (vRA) 7.2, Azure endpoints can now be consumed with limited functionality. Limited because Software Component integration does not yet exist for Azure in vRA. Despite that, this announcement is a pretty big deal. I recently worked with a customer who presented a requirement to to provision RedHat 7.2 machines in Azure from their vRA portal.  Essentially, this process would be deemed relatively simple to follow for anyone who has targeted a vSphere template, or AWS AMI via its ID in the Blueprint Editor in vRA.  Unlike those other endpoints however, Azure Marketplace machines are not identified via something as simple as a name or single ID string.  Alternatively, Azure machine images in vRA are identified via a concatenated list of identifiers which make up the unique URN which vRA requires.

Within the blueprint editor of your Azure machine in vRA, you will be confronted with a free-form field requiring a “Virtual Machine Image” value.  Hovering over the tooltip (little question mark icon) indicates that if you are provisioning a machine found in the Azure Marketplace (which this customer required in fact), the image URN should follow the [publisher:offer:sku:version] format.

Azure Machine Image tooltip in vRA

Azure Machine Image tooltip in vRA

This is awesome, except where do you obtain any of that information?  To make life easy on myself, I first jumped into to the Azure UI looking to see if perhaps, those things were visible in the properties of the machine image we were targeting.  This unfortunately was not the case.  Where that left me, was following the advice of the tooltip next to the field.  On the notification, it mentions that you can use the Azure CLI to gather everything you need to create the unique ID.  I quickly got the CLI tools installed, and ran the command specified in the tooltip i.e. “azure vm image list”.  Uhhhh no.  This was completely unhelpful and will undoubtedly be for you too if you are following it which leads me to the solution for anyone else who ran into this problem.

Solution:

There may be a multitude of ways to gather the information needed, however here is what I did.

    1. If you haven’t already, install the Azure CLI for powershell.  Steps are here.
    2. At the command line, login to your Azure account using the ‘Login-azureRMAccount’ command like below.  A window should appear that accepts your credentials:
    3.  Now, create a location variable which takes the Azure region you are targeting as an assignment.  In my case, I chose ‘eastus’:
    4. Next, we should obtain the publisher.  We’ll obtain that by issuing the ‘Get-AzureRmVMImagePublisher’ command and passing the $loc variable to the ‘Location’ argument:

      1. This returns a long list of publishers, however I’ve displayed the one relevant to my customer, which is RedHat in this case
    5. Here, we’ll obtain the offer.  We’ll obtain that by issuing the ‘Get-AzureRmVMImageOffer’ command and passing the $loc variable to the ‘Location’ argument, and the publisher name to the ‘PublisherName’ argument (RedHat in my example).  You should see a pattern developing here:

      1. This returns a list of offers, which in my case RHEL is the correct option
    6. Next, let’s grab the sku.  We’ll obtain that by issuing the ‘Get-AzureRmVMImageSku’ command and passing the $loc variable to the ‘Location’ argument, the publisher name to the ‘PublisherName’ argument, and the offer name to the ‘Offer’ argument (RHEL in my example):

      1. This returns a list of skus, which in my case 7.2 is the one requested by my customer
    7. Finally, let’s grab the version.  We’ll obtain that by issuing the ‘Get-AzureRmVMImage’ command and passing the $loc variable to the ‘Location’ argument, the publisher name to the ‘PublisherName’ argument, the appropriate Offer to the ‘Offer’ argument, and the appropriate Sku to the ‘Skus’ argument (7.2 in my example). Whew.

      1. This returns a list of versions, which in my case 7.2.20170223 is the correct option

With this information, we can now formulate our Virtual Machine Image string and supply it to vRA.  Recall that the format vRA expects looks like this:

So for me, the format is:

Paste this into the Virtual Machine Image field in the Azure Machine Blueprint’s Virtual Machine Image field in vRA and you should be good to go! Good Luck.

 

Azure Virtual Machine Image Field in vRealize Automation vRA

Azure Virtual Machine Image Field in vRealize Automation vRA

Calvin

Leave a Reply

Your email address will not be published. Required fields are marked *