Skip to content

Use a location parameter for regional resources#

Operational Excellence · All resources · Azure.Template.ResourceLocation

Template resource location should be an expression or global.

Description#

The template parameter location is a standard parameter recommended for deployment templates. The location parameter is a intended for specifying the deployment location of the primary resource.

When defining a resource that requires a location, use the location parameter. For example:

{
    "type": "Microsoft.Network/virtualNetworks",
    "name": "[parameters('VNETName')]",
    "apiVersion": "2020-06-01",
    "location": "[parameters('location')]",
    "properties": {}
}

Additionally, the template may include other resources. Use the location parameter value for resources that are likely to be in the same location. This approach minimizes the number of times users are asked to provide location information. For resources that aren't available in all locations, use a separate parameter.

For non-regional resources such as Front Door and DNS Zones specify a literal location global.

Recommendation#

Consider updating the resource location property to use [parameters('location)].


Last update: 2021-09-24