**TL;DR:** Template validation failures nest: the outer error is generic, the real cause (bad parameter, wrong apiVersion, missing dependsOn) is in details[]. Script the extraction. Check the parameter file types. Move region or SKU.

## The error

```text
InvalidTemplateDeployment
```

## The fix

1. **Parameter type mismatch.** "The provided value ... is not valid" - a string where an int was expected, or a secureString passed as plain text. Check the parameter file types.

2. **apiVersion too old/new.** The resource type does not support a property at the apiVersion you pinned. The error names the property; check the resource provider docs for the apiVersion that introduced it.

3. **Location not available.** "The location ... is not available for resource type" - the SKU does not exist in that region. Move region or SKU.

4. **dependsOn / reference() ordering.** Referencing a resource property before it exists. Bicep's symbolic references handle most of this; raw ARM templates need explicit dependsOn.

5. **Template language expression.** A stray `[` in a string makes ARM parse it as an expression. In Bicep this is rarer; in JSON templates escape as `[[`. Workflow: `az bicep build` (compile check) then `what-if` (semantic check) then create. Each stage catches a different class; skipping straight to create wastes the 5-minute deployment cycle on syntax errors.

## When to use this

- You are seeing this exact error message; match the block above, not just part of it.
- The failing call matches the scenario in the title: Azure InvalidTemplateDeployment.
- You want the fastest verified fix before digging through logs.

## When not to use this

- Your error text differs from the block above; close cousins often have different causes.
- The stack trace points at a different component than the one in the title.
- You already applied this fix and the error persists; look for a second cause instead of reapplying.

## Also seen as

- `az deployment group show --resource-group [rg] --name [deployment]   --query "properties.error.details[].message"`