2. Validate the ARM Template
After downloading or creating an ARM template for an environment, it’s a good idea to validate it. Validation ensures the template has no bugs or syntax issues and can be successfully deployed to Azure with no errors.
Using the Azure CLI, validate an ARM template by running the az group deployment validate command as shown here. Be sure to first replace your_resource_group_name with the name of an actual resource group in your Azure subscription. This command reads the template LinuxVirtualMachine.json and parameters defined in the file LinuxVirtualMachine.parameters.json, which then validates the ARM template and the parameters file.
az group deployment validate --resource-group your_resource_group_name --parameters .\LinuxVirtualMachine.parameters.json --template-file .\LinuxVirtualMachine.json
3. Deploy the ARM Template
Using the Azure CLI again, deploy the Azure resources defined in the template using az group deployment command again. This time, however, remove the validate command to deploy the Azure resources defined in the ARM template.
az group deployment create --resource-group your_resource_group_name --parameters .\LinuxVirtualMachine.parameters.json --template-file .\LinuxVirtualMachine.json.
This command reads the LinuxVirtualMachine.json ARM template and the LinuxVirtual Machine.parameters.json parameters file. It then replaces all of the parameter place holders in the ARM template with values in the parameters file and invokes the deployment.