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 below. Be sure to replace yourresourcegroup_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 yourresourcegroup_name --parameters .\LinuxVirtualMachine.parameters.json --template-file .\LinuxVirtualMachine.json
3. Deploy the ARM Template
Using the Azure CLI once again, deploy the Azure resources defined in the template using the 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 yourresourcegroup_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 placeholders in the ARM template with values in the parameters file and invokes the deployment.