Skip to content

Default should match type#

Operational Excellence · All resources · Rule · 2021_03 · Important

Set the parameter default value to a value of the same type.

Description#

Azure Resource Manager (ARM) template support parameters with a range of types, including:

  • bool
  • int
  • string
  • array
  • object
  • secureString
  • secureObject

When including a defaultValue, the default value should match the same type at the type property. For example:

Azure Template snippet
{
  "boolParam": {
    "type": "bool",
    "defaultValue": false
  },
  "intParam": {
    "type": "int",
    "defaultValue": 5
  },
  "stringParam": {
    "type": "string",
    "defaultValue": "test-rg"
  },
  "arrayParam": {
    "type": "array",
    "defaultValue": [ 1, 2, 3 ]
  },
  "objectParam": {
    "type": "object",
    "defaultValue": {
      "one": "a",
      "two": "b"
      }
  }
}

Recommendation#

Consider updating the parameter default value to a value of the same type.

Comments