Why is this an issue?

According to the best practices defined by Azure, a consistent order of properties in a template is recommended. This makes it easier to read and understand the template.

Not following this convention has no technical impact, but will reduce the template’s readability because most developers are used to the standard order.

Important note: It is possible to reference objects that are defined then in the file. There is no requirement to first define objects and later reference them.

How to fix it in JSON templates

Code examples

Compliant solution

Recommended order of properties:

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/...",
  "contentVersion": "1.0.0.0",
  "metadata": {},
  "apiProfile": "...",
  "parameters": {},
  "functions": {},
  "variables": {},
  "resources": [],
  "outputs": {}
}

How to fix it in Bicep

Code examples

Compliant solution

Recommended order of elements:

targetScope ...
metadata ...
param ...
func ...
var ...
resource ... // (existing resources collected together)
resource ... // (new resources)
module ...
output ...

Resources

Documentation