| reviewed | 2024-01-27 |
|---|---|
| severity | Important |
| pillar | Operational Excellence |
| category | OE:05 Infrastructure as code |
| resource | All resources |
| online version | https://azure.github.io/PSRule.Rules.Azure/en/rules/Azure.Template.TemplateFile/ |
Use ARM template files that are valid.
Azure Resource Manager (ARM) template files have a pre-defined structure.
ARM templates require $schema, contentVersion and resources sections to be defined.
If any of these sections are missing, ARM will not accept the template.
Consider reviewing the requirements for this file. Also consider using Visual Studio Code to assist with authoring these files.
To define Azure template files that pass this rule:
- Always specify the required properties
$schema,contentVersionandresourcesproperties. - Optional specify
languageVersion,definitions,metadata,parameters,functions,variables, andoutputsproperties. - Avoid specifying any other properties.
For example:
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": { },
"variables": { },
"resources": [ ]
}This rule is not applicable to Azure Bicep files as they have a different structure. If you are running analysis over pre-built Bicep files and they generate a rule failure, please raise an issue.