|
| 1 | +--- |
| 2 | +title: 'Preflight: Server-side validation before deployment' |
| 3 | +description: Server‑side validation phase that runs after the template is submitted but before any resources are created or modified. |
| 4 | +ms.topic: article |
| 5 | +ms.date: 03/04/2026 |
| 6 | +--- |
| 7 | + |
| 8 | +# Preflight: Server validation before deployment |
| 9 | + |
| 10 | +Preflight is the server validation phase that runs after you submit the template but before Azure creates or modifies any resources. |
| 11 | + |
| 12 | +To understand preflight, it helps to see where it fits compared to other checks: |
| 13 | + |
| 14 | +1. [**Linting (Static Check)**](./linter.md): Checks syntax and best practices (for example, "You have an unused variable") while you type in VS Code. |
| 15 | +2. **Deployment Validation (The "Dry Run")**: This step is preflight. It sends your template to Azure to see if Azure Resource Manager (ARM) accepts the configuration. |
| 16 | +3. [**What-If**](./deploy-what-if.md): Predicts exactly which resources are created, modified, or deleted. |
| 17 | +4. [**Deployment**](./deploy-cli.md): The actual execution where Azure builds the resources. |
| 18 | + |
| 19 | +When you trigger a preflight check, Azure doesn't just look at the code. It looks at the live environment and the resource provider (the service responsible for the specific resource, like Microsoft.Compute). It verifies: |
| 20 | + |
| 21 | +- Parameter values (types, allowed values, missing required parameters) |
| 22 | +- Resource name conflicts (for example, globally unique names already taken) |
| 23 | +- Scope correctness (resource group versus subscription versus tenant) |
| 24 | +- RBAC permissions (whether you can deploy those resource types) |
| 25 | +- Basic provider and API compatibility |
| 26 | + |
| 27 | +If any of these checks fail, the deployment never starts. |
| 28 | + |
| 29 | +## Limitations |
| 30 | + |
| 31 | +- Runtime errors: Preflight can't catch everything. For example, if a custom script extension fails during execution because of a typo inside a bash script, preflight won't see that error. |
| 32 | +- Dependent values: If Resource B depends on a property generated by Resource A (like a dynamic IP address), preflight might only perform a partial check because that value doesn't exist yet. |
| 33 | + |
| 34 | +## Run preflight |
| 35 | + |
| 36 | +Preflight validation runs automatically when you use deployment validate or what-if style commands. For example, preflight validation runs during these operations: |
| 37 | + |
| 38 | +- ARM JSON or Bicep validation in Azure CLI or PowerShell |
| 39 | + |
| 40 | + # [Azure CLI](#tab/azure-cli) |
| 41 | + |
| 42 | + ```azurecli |
| 43 | + az deployment group validate \ |
| 44 | + --resource-group myResourceGroup \ |
| 45 | + --template-file main.bicep |
| 46 | + ``` |
| 47 | + |
| 48 | + # [PowerShell](#tab/azure-powershell) |
| 49 | + |
| 50 | + ```azurepowershell |
| 51 | + Test-AzResourceGroupDeployment ` |
| 52 | + -ResourceGroupName myResourceGroup ` |
| 53 | + -TemplateFile ./main.bicep |
| 54 | + ``` |
| 55 | +
|
| 56 | + For more information, see [Deploy Bicep files with the Azure CLI](./deploy-cli.md) and [Deploy Bicep files with the Azure PowerShell](./deploy-powershell.md). |
| 57 | +
|
| 58 | +- what-if |
| 59 | + What-if includes preflight checks before calculating changes unless you configure it to skip the preflight. For more information, see [Running the what-if operation](./deploy-what-if.md#running-the-what-if-operation). |
| 60 | +
|
| 61 | +- Azure portal "Review + create" step |
| 62 | +
|
| 63 | + Currently, the Azure portal only supports deploying ARM JSON templates. For more information, see [Deploy ARM templates with the Azure portal](../templates/deploy-portal.md). |
| 64 | +
|
| 65 | +Preflight errors appear in the Activity Log but not in deployment history, because the deployment never began. |
| 66 | +
|
| 67 | +## Next steps |
| 68 | +
|
| 69 | +- To use the what-if operation, see [Bicep What-If: Preview Changes Before Deployment](./deploy-what-if.md) |
0 commit comments