Check your templates for Azure Stack with the template validation tool

Applies to: Azure Stack integrated systems and Azure Stack Development Kit

You can use the template validation tool to check if your Azure Resource Manager templates are ready for deploying to Azure Stack. The template validation tool is available as a part of the Azure Stack tools. Download the Azure Stack tools by using the steps described in the download tools from GitHub article.


To validate a template, you have to build a cloud capabilities file first and then run the validation tool. You use the following PowerShell modules from Azure Stack tools:

  • In the CloudCapabilities folder:
    AzureRM.CloudCapabilities.psm1 creates a cloud capabilities JSON file representing the services and versions in an Azure Stack cloud.
  • In the TemplateValidator folder:
    AzureRM.TemplateValidator.psm1 uses a cloud capabilities JSON file to test templates for deployment in Azure Stack.

Build the cloud capabilities file

Before you use the template validator, run the AzureRM.CloudCapabilities PowerShell module to build a JSON file.


If you update your integrated system, or add any new services or virtual extensions, you should run this module again.

  1. Make sure you have connectivity to Azure Stack. These steps can be performed from the Azure Stack development kit host, or you can use a VPN to connect from your workstation.
  2. Import the AzureRM.CloudCapabilities PowerShell module:

    Import-Module .\CloudCapabilities\AzureRM.CloudCapabilities.psm1
  3. Use the Get-CloudCapabilities cmdlet to retrieve service versions and create a cloud capabilities JSON file. If you don't specify -OutputPath, the file AzureCloudCapabilities.Json is created in the current directory. Use your actual location:

    Get-AzureRMCloudCapability -Location <your location> -Verbose

Validate templates

Use these steps to validate templates by using the AzureRM.TemplateValidator PowerShell module. You can use your own templates, or validate the Azure Stack Quickstart templates.

  1. Import the AzureRM.TemplateValidator.psm1 PowerShell module:

    cd "c:\AzureStack-Tools-master\TemplateValidator"
    Import-Module .\AzureRM.TemplateValidator.psm1
  2. Run the template validator:

    Test-AzureRMTemplate -TemplatePath <path to template.json or template folder> `
    -CapabilitiesPath <path to cloudcapabilities.json> `

Template validation warnings or errors are logged to the PowerShell console and an HTML file in the source directory. The following screen capture shows an example of a validation report:

Template validation report


The template validator supports the following parameters.

Parameter Description Required
TemplatePath Specifies the path to recursively find Azure Resource Manager templates Yes
TemplatePattern Specifies the name of template files to match. No
CapabilitiesPath Specifies the path to cloud capabilities JSON file Yes
IncludeComputeCapabilities Includes evaluation of IaaS resources like VM Sizes and VM Extensions No
IncludeStorageCapabilities Includes evaluation of storage resources like SKU types No
Report Specifies name of the generated HTML report No
Verbose Logs errors and warnings to the console No


This example validates all of the Azure Stack Quickstart templates downloaded to local storage. The example also validates virtual machine sizes and extensions against Azure Stack Development Kit capabilities.

test-AzureRMTemplate -TemplatePath C:\AzureStack-Quickstart-Templates `
-CapabilitiesPath .\TemplateValidator\AzureStackCloudCapabilities_with_AddOns_20170627.json `
-TemplatePattern MyStandardTemplateName.json`
-Report TemplateReport.html

Next steps