
… with Azure CLI
If you wish to deploy an Azure VM from a MarketPlace image, especially from some 3rd party vendors, you may come across the need to ‘Accept’ Legal terms for the VM Image on the subscription.
Via the Azure Portal, this is very straightforward. However, if you are scripting or automating the provisioning of an image, that requires the acceptance of Legal terms, you will notice a message similar to the following:
{
"error": {
"additionalInfo": null,
"code": "MarketplacePurchaseEligibilityFailed",
"details": [
{
"additionalInfo": null,
"code": "BadRequest",
"details": null,
"message": "Offer with PublisherId: 'barracudanetworks', OfferId: 'waf' cannot be purchased due to validation errors. For more information see details. Correlation Id: 'redacted' You have not accepted the legal terms on this subscription: 'redacted' 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=862451 or the PowerShell commands available at https://go.microsoft.com/fwlink/?linkid=2110637. Alternatively, deploying via the Azure portal provides a UI experience for reading and accepting the legal terms. Offer details: publisher='barracudanetworks' offer = 'waf', sku = 'hourly', Correlation Id: 'redacted'.[{\"You have not accepted the legal terms on this subscription: 'redacted' 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=862451 or the PowerShell commands available at https://go.microsoft.com/fwlink/?linkid=2110637. Alternatively, deploying via the Azure portal provides a UI experience for reading and accepting the legal terms. Offer details: publisher='barracudanetworks' offer = 'waf', sku = 'hourly', Correlation Id: 'redacted'.\":\"StoreApi\"}]",
"target": null
}
],
"message": "Marketplace purchase eligibilty check returned errors. See inner errors for details. ",
"target": null
},
"properties": null
}
In this instance, the message applies to an image from Barracuda Networks. However, it could equally be from another vendor, even Microsoft. The good news is that the same process for acceptance of the terms applies regardless of the Publisher.
Note, from the message received, the elements ‘Publisher’, ‘Offer’ and ‘Sku’:publisher='barracudanetworks' offer = 'waf', sku = 'hourly'
These details can be used when accepting the terms from the Azure CLI.
For the error message above, I have accepted the terms using the following command:az vm image terms accept
What you should note is, that although the original error message stated sku
is required, I found that this wasn’t being accepted.
It turned out I had to define the hourly
run-rate under plan
rather than sku
, therefore, the complete command to successfully accept the terms was as follows:az vm image terms accept --offer waf --publisher barracudanetworks --plan hourly
Note some of the details in the success output particularly the licensing terms which can be found under licenseTextLink
. You really ought to read these before running the command in the first place 🙂

… with PowerShell
If you prefer to use PowerShell, and have access to the respective cmdlets, you can use the Get-AzureRmMarketplaceTerms
and Set-AzureRmMarketplaceTerms -accept
However, you should note:
the Set-AzureRmMarketplaceTerms cmdlet saves the terms object for given publisher id(Publisher), offer id(Product) and plan id(Name) tuple.