Enabling Programmatic Access in Azure

In order to be able to deploy Azure Marketplace solutions into Azure using an ARM template it is necessary to enable programmatic access for that offering within your Azure Subscription.

This used to be a clumsy exercise through the Azure Portal, but it can now be done through the AZ CLi and PowerShell. This post shows how this can be achieved.

Enabling programmatic access in your subscription is necessary for any image that is not a base OS image, Chef Automate for example. This is a one time action in your subscription, but has to be done for every marketplace image you want to deploy programmatically.

Programmatic access allows images to be deployed using an ARM Template, API or the command line (both AZ Cli and PowerShell).

Prerequisites

To enable programmatic access for your chosen image, you will need one of the following tools:

Enabling Access

For the purposes of the this examples programmatic access will enable it for the Chef Server BYOL (Bring You Own Licence) image.

It is assumed that your chosen tool is already logged into the Azure Subscription for which you want to enable access.

Azure CLI

List the Chef Server offerings

az vm image list --all --publisher chef-software -o table

Azure Command Line Image list

Select the image that needs to be deployed programmatically and get the ‘Urn’ for use with the following command.

az vm image accept-terms --urn chef-software:chef-automate-vm-image:byol:1.8.683

To get the publisher name, product and SKU please review the following Azure CLI commands:

  • az vm image --list-publishers
  • az vm image --list-offers
  • az vm image --list-skus

PowerShell

Use the following command in PowerShell to enable access.

Get-AzureRmMarketPlaceTerms -Name byol -Publisher chef-software -Product chef-automate-vm-image | Set-AzureMarketplaceTerms --accept

To get the details of other publishers, offers and skus look at the following PowerShell cmdlets.

  • Get-AzureRMVMImagePublisher
  • Get-AzureRMVMImageOffer
  • Get-AzureRMVMImageSKU
Share Comments