Lessons learned deploying Azure MarketPlace Virtual Machine


Last week I needed to deploy an Windows 2016 Data Science Virtual Machine from the Azure MarketPlace.

The Azure Marketplace is an online applications and services marketplace that enables start-ups and independent software vendors (ISVs) to offer their solutions to Azure customers around the world.

The Azure Marketplace combines Microsoft Azure partner ecosystems into a single, unified platform to better serve our customers and partners. This will improve existing experiences and make it easier to search, purchase, and deploy a wide range of applications and services in just a few clicks.

During this process I learned some lessons I wanted to share in this blog post.

Lesson 1 - Accept MarketPlace terms

Before you can deploy a MarketPlace item like the Windows 2016 Data Science Virtual Machine you first need accept the MarketPlace terms.

If don't accept the MarketPlace terms you will see the following error message during the deployment.

There were errors in your deployment. Error code: MarketplacePurchaseEligibilityFailed.
Marketplace purchase eligibilty check returned errors. See inner errors for details. 
Details:
BadRequest: Offer with PublisherId: Microsoft-ads, OfferId: windows-data-science-vm cannot be purchased due to validation errors. See details for more information.[{"Legal terms have not been accepted for this item on this subscription. To accept legal terms using PowerShell, please use Get-AzureRmMarketplaceTerms and Set-AzureRmMarketplaceTerms API(https://go.microsoft.com/fwlink/?linkid=862451) or deploy via the Azure portal to accept the terms":"StoreApi"}] undefined
Task failed while creating or updating the template deployment.

According to the error message you need the Get-AzureRmMarketPlaceTerms and Set-AzureRmMarketplaceTerms PowerShell cmdlets to accept the MarketPlace terms.

But how do you find the correct parameter values for the Get-AzureRmMarketPlaceTerms cmdlet?

Here is an example for another MarketPlace item, the Ubuntu CIS Hardened image.

You can use the following PowerShell commands to retrieve the values needed to accept the MarketPlace Terms:

#region Connect to Azure
Add-AzureRmAccount
 
#Select Azure Subscription
$subscription = 
(Get-AzureRmSubscription |
        Out-GridView `
        -Title 'Select an Azure Subscription ...' `
        -PassThru)
 
Set-AzureRmContext -SubscriptionId $subscription.Id -TenantId $subscription.TenantID
#endregion

#region get parameter values to Accept MarketPlace terms for Windows 2016 Data Science VM
Get-AzureRmVMImageOffer -PublisherName 'Microsoft-ads' -Location 'westeurope' | Get-AzureRmVMImageSKu
#endregion

Next step is to retrieve the MarketPlace terms and accept those using the following commands:

Get-AzureRmMarketplaceTerms -Publisher 'Microsoft-ads' -Product 'windows-data-science-vm' -Name 'windows2016' |
    Set-AzureRmMarketplaceTerms -Accept

You have now accepted the MarketPlace terms for the Windows 2016 Data Science Virtual Machine and can continue with the deployment.

Lesson 2 - Azure Resource Manager parameters are case-sensitive.

After accepting the MarketPlace terms using PowerShell you can also verify this using the Azure Portal.

Go to your Subscription and select 'Programmatic deployment'

The final step is to deploy the Windows Data Science Virtual Machine. I used ARM Templates with a VSTS (Visual Studio Team Services) CI/CD Pipeline.

In my azuredeploy.parameter.json file I configured the following parameter values regarding the Windows 2016 Data Science VM:

"sku": {
  "value": "windows2016"
},
"publisher": {
  "value": "Microsoft-ads"
},
"offer": {
  "value": "windows-data-science-vm"
},
"version": {
  "value": "latest"
},

Don't forget to add a plan attribute in the azuredeploy.json file for the Virtual Machine Resource.

"plan": {
        "name": "[parameters('sku')]",
        "publisher": "[parameters('publisher')]",
        "product": "[parameters('offer')]"
      },

I thought I did everything correctly but the deployment failed with the following error:

{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-debug for usage details.","details":[{"code":"Conflict","message":"{\r\n \"status\": \"Failed\",\r\n \"error\": {\r\n \"code\": \"ResourceDeploymentFailure\",\r\n \"message\": \"The resource operation completed with terminal provisioning state 'Failed'.\",\r\n \"details\": [\r\n {\r\n \"code\": \"VMMarketplaceInvalidInput\",\r\n \"message\": \"The purchase information does not match. Unable to deploy from the Marketplace image. OS disk name is 'ds-d-vm-01_OsDisk_1_'.\"\r\n }\r\n ]\r\n }\r\n}"}]}

The important part of this error message is the following:

The purchase information does not match

It turns out the ARM Template parameters values are case-sensitive when deploying a MarketPlace item!

You need to change the parameter input value for publisher to lower-case. 'Microsoft-ads' needs to become 'microsoft-ads':

"sku": {
  "value": "windows2016"
},
"publisher": {
  "value": "microsoft-ads"
},
"offer": {
  "value": "windows-data-science-vm"
},
"version": {
  "value": "latest"
},

After this change I was able to deploy the Windows 2016 Data Science Virtual Machine successfully.

Hope you find this blog post useful.

References:

Comments (0)

Skip to main content