What is Azure Marketplace? Azure Marketplace is an online applications and services market for solutions built or used in Azure. Using Azure Marketplace to deploy virtual machines, gives you the flexibility of virtualization for a wide range of computing solutions—development and testing, running applications, and extending your datacenter.
With a little modification to your existing ARM templates, you can deploy any Azure Marketplace virtual machine (VM) by simply changing a few values in your parameters file and adding the “plan” to your template.
Here are 3 steps to follow when deploying these Azure Marketplace VMs:
- Accept the terms for the Azure Marketplace VMs.
- Include the “plan” in your ARM template.
- Deploy to Azure.
Accept Marketplace Terms
Accepting the terms for the Azure Marketplace VM is the first and most important step. Without accepting the terms, you will not be able to deploy the VM. When it comes to accepting the terms, you will need to know the publisher, product, and name for the VM you are wanting to deploy.
First, run the command below. This will give you a list of all the Image Publishers available in the region that you specify. (change the location to the region you are deploying to)
|Get-AzVMImagePublisher -location ‘<insert location here>’|
Next, take the PublisherName of the image you are accepting the terms for and run the following command:
|Get-AzVmImageOffer -PublisherName ‘<insert PublisherName here>’ -location ‘<insert location here>’ | Get-AzVMImageSku|
Lastly, enter the PublisherName for the Publisher, the Offer for the Product, and the SKU for the Name and run the following command:
|Get-AzMarketplaceTerms -Publisher ‘<insert PublisherName here>’ -Product ‘<insert Offer here>’ -Name ‘<insert SKU here>’ | Set-AzMarketplaceTerms -Accept|
To double check if the Marketplace Terms have been accepted, navigate to the Azure Portal and select Subscriptions.
Select the subscription where the terms were accepted.
Under Settings, click Programmatic Deployments. Here, you should now see the Marketplace Item(s) that you have accepted the terms for.
Your ARM Template MUST include the “plan”
The second step in deploying an Azure Marketplace VM is making sure that your ARM template includes the “plan”. It is critical that the templates includes the “plan” because this defines what Azure Marketplace VM you are deploying. See below where to include the “plan” in your template.
If you notice, the “plan” needs to be part of the VM creation in your template. This defines what Marketplace VM will be created. You will need to include in your parameters: the SKU, Publisher, and Offer. Also note that the ARM Template parameters values are case-sensitive, so they must all be lowercase.
Having accepted the Marketplace Terms and making sure that the ARM Template includes the “plan”, you are now ready to deploy your Azure Marketplace VM. Assuming that you have the Az Module installed in PowerShell, you will need to give the deployment a name, associate it to a Resource Group, and provide the Template and Parameters File paths. Run the following command:
|New-AzResourceGroupDeployment -Name ExampleDeployment -ResourceGroupName ExampleResourceGroup ` -TemplateFile c:\MyTemplates\azuredeploy.json ` -TemplateParameterFile c:\MyTemplates\storage.parameters.json|
The new Azure Marketplace VM should now be deploying in Azure. Hope this helps!