ResourcePurchaseValidationFailed

Steps to guide you through accepting Azure images with marketplace terms from the Azure Cloud Shell and Azure CLI

Overview

Some VM images in Azure have additional terms and licensesarrow-up-right that must be accepted before you can deploy the image programmatically.

Our webservicearrow-up-right example uses an NGINX Bitnami VM image in Azure that includes a policy that must first be accepted. The NGINX image has the following properties defined in the Blueprint:

bitnami:

  publisher: bitnami

  product: nginxstack

  sku: 1-9

When applying a blueprint containing a VM image that requires acceptance you receive the following error in the environment Job detailsarrow-up-right.

Failed to create VirtualMachine ['webservice-tuono-webservice', 'webserver-2']: 

Azure Error: ResourcePurchaseValidationFailed 
Message: User failed validation to purchase resources. 

Error message: 'You have not accepted the legal terms on this subscription: '33de00cd-d545-47cb-8939-193f9b5fafa4' for this plan. 

Before the subscription can be used, you need to accept the legal terms of the image. 

To read and accept legal terms, 
use the Azure CLI commands described at https://go.microsoft.com/fwlink/?linkid=2110637 
or the PowerShell commands available at https://go.microsoft.com/fwlink/?linkid=862451. 

Offer details:  publisher:'bitnami'  offer = 'nginxstack', sku = '1-9', Correlation Id: '[GUID]'

Resolution

The resolution uses the NGINX specific image details but the steps are valid with any image. To obtain the details for your specific image you can view the Offer details in the Azure error message or visit this KB.arrow-up-right

Azure Cloud Shell

a. Select a subscription and create a storage account by clicking "Create storage"

b. Change the environment type to Powershell in the top left

  1. You can view the marketplace terms with Get-AzMarketplaceterms.arrow-up-right

Get-AzMarketplaceterms -Publisher "bitnami" -Product "nginxstack" -Name "1-9"

  1. Accept the marketplace terms with Set-AzureRmMarketplaceTerms.

Get-AzMarketplaceterms -Publisher "bitnami" -Product "nginxstack" -Name "1-9" | Set-AzureRmMarketplaceTerms -Accept

You are now ready to apply your blueprint!

Azure CLI

  1. Install the Azure CLIarrow-up-right with your preferred method or you can issue azure cli commands in Azure Cloud Shell.arrow-up-right

  2. Sign into the the Azure CLI and follow provided login:

az login

  1. You can view the marketplace terms with az vm image terms showarrow-up-right.

az vm image terms show --publisher bitnami --offer nginxstack --plan 1-9

  1. Accept the marketplace terms with az vm image terms acceptarrow-up-right.

az vm image terms accept --publisher bitnami --offer nginxstack --plan 1-9

You are now ready to apply your blueprint!

Last updated

Was this helpful?