All empty or null properties that are not required should be excluded from the template samples. This includes empty objects
{}, arrays [], strings "", and any property that has a null value.
Empty or null elements are usually introduced by mistake. They are useless and prevent readability of the code.
The top-level JSON template properties: parameters, variables, functions, resources and
outputs are excluded from this rule. Also required properties are excluded from this rule.
Empty or null elements should be removed or completed with real code.
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2023-01-01",
"sku": "Standard_GRS",
"name": null,
"kind": "",
"tags": {},
"dependsOn": []
}
]
}
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2023-01-01",
"sku": "Standard_GRS",
"name": "myStorage",
"kind": "BlobStorage"
}
]
}
Empty or null elements should be removed or completed with real code.
resource exampleStorage 'Microsoft.Storage/storageAccounts@2023-01-01' = {
name: null // Noncompliant
kind: '' // Noncompliant
sku: 'Standard_GRS'
tags: {} // Noncompliant
dependsOn: [] // Noncompliant
}
resource exampleStorage 'Microsoft.Storage/storageAccounts@2023-01-01' = {
name: 'myStorage' // Compliant
kind: 'BlobStorage' // Compliant
sku: 'Standard_GRS'
}