Diagnosing MissingRequiredParameter Errors in Nested ARM Deployments
0 reputation · 21 May 2025, 14:03 UTC
0 reputation · 21 May 2025, 14:03 UTC
Determine why a nested deployment fails with the MissingRequiredParameter error for parameter location even though the parent template supplies a default value.
location with a default value.location but declares no default.deployment resource, not an inline template.Azure documentation states that defaults are not automatically propagated to nested deployments, yet the exact propagation rules—especially across ARM JSON and Bicep compiled JSON—are unclear.
No. The ARM runtime does not inherit or propagate parameter values—defaulted or otherwise—from a parent template into a nested Microsoft.Resources/deployments resource. A nested deployment is a separate deployment scope: every parameter it declares without its own defaultValue must be supplied explicitly in the nested deployment's parameters object. Your MissingRequiredParameter for location means the nested template declares location with no default, and the parent's deployment resource either omits it from parameters or passes an expression that evaluated to null.
Confirmed: the parent's defaultValue applies only when the parent's own parameter is evaluated. It is a value the parent can reference, not something the runtime forwards. When you write "value": "[parameters('location')]" in the nested deployment, the resolved value (default or user-supplied) is passed explicitly—nothing is automatic.
Likely in your case: the parent defines location with a default, but the nested deployment resource's properties.parameters block has no location entry, so the nested template's required parameter is unfulfilled. A less common variant is a mapping that exists but produces null (for example, referencing a mistyped variable or parameter name), which surfaces as the same error.
Map the parameter explicitly in the parent template:
"resources": [
{
"type": "Microsoft.Resources/deployments",
"apiVersion": "2022-09-01",
"name": "nested",
"properties": {
"mode": "Incremental",
"templateLink": { "uri": "..." },
"parameters": {
"location": { "value": "[parameters('location')]" }
}
}
}
]
In Bicep, pass it as a module parameter—Bicep compiles modules to the same nested deployment shape, and there is no automatic parameter inheritance:
param location string = resourceGroup().location
module nested 'nested.bicep' = {
name: 'nested'
params: {
location: location
}
}
An alternative is to redeclare the same defaultValue in the nested template. This makes the nested template self-sufficient when it's also deployed standalone, but the two defaults can drift apart, so explicit mapping is usually the safer choice.
There is no known ARM engine or Bicep compiler version difference that changes this behavior; Bicep-compiled JSON follows identical runtime semantics. Failures of this kind trace to template authoring, not engine versions.
bicep build and confirm the compiled nested deployment contains parameters.location with a value expression.az deployment group what-if (or New-AzResourceGroupDeployment -WhatIf) to reproduce the parameter resolution error cheaply.az deployment group show to confirm which scope raised the error.defaultValue for location in the nested template. If the error disappears, the missing explicit mapping was the cause.One caveat: if you use templateLink, verify the linked URI actually serves the template version you edited—stale linked templates are a common source of confusion.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.