Skip to content

Commit cfd5ec3

Browse files
committed
Add preflight information
1 parent 26cd89c commit cfd5ec3

5 files changed

Lines changed: 76 additions & 4 deletions

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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)

articles/azure-resource-manager/bicep/deploy-what-if.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Azure CLI version **2.76.0 or later** introduces the `--validation-level` switch
7878

7979
- **Provider** (default): Performs full validation, including template syntax, resource definitions, dependencies, and permission checks to ensure you have sufficient permissions to deploy all resources in the template.
8080
- **ProviderNoRbac**: Performs full validation of the template and resources, similar to Provider, but only checks for read permissions on each resource instead of full deployment permissions. This is useful when you want to validate resource configurations without requiring full access.
81-
- **Template**: Performs static validation only, checking template syntax and structure while skipping preflight checks (for example, resource availability) and permission checks. This is less thorough, potentially missing issues that could cause deployment failures.
81+
- **Template**: Performs static validation only, checking template syntax and structure while skipping [preflight checks](./deploy-preflight.md) (for example, resource availability) and permission checks. This is less thorough, potentially missing issues that could cause deployment failures.
8282

8383
You can use the `--confirm-with-what-if` switch (or its short form `-c`) to preview the changes and get prompted to continue with the deployment. Add this switch to:
8484

@@ -104,7 +104,7 @@ Azure PowerShell version **13.4.0 or later** introduces the `-ValidationLevel` s
104104

105105
- **Provider** (default): Performs full validation, including template syntax, resource definitions, dependencies, and permission checks to ensure you have sufficient permissions to deploy all resources in the template.
106106
- **ProviderNoRbac**: Performs full validation of the template and resources, similar to Provider, but only checks for read permissions on each resource instead of full deployment permissions. This is useful when you want to validate resource configurations without requiring full access.
107-
- **Template**: Performs static validation only, checking template syntax and structure while skipping preflight checks (for example, resource availability) and permission checks. This is less thorough, potentially missing issues that could cause deployment failures.
107+
- **Template**: Performs static validation only, checking template syntax and structure while skipping [preflight checks](./deploy-preflight.md) (for example, resource availability) and permission checks. This is less thorough, potentially missing issues that could cause deployment failures.
108108

109109
You can use the `-Confirm` switch parameter to preview the changes and get prompted to continue with the deployment.
110110

articles/azure-resource-manager/bicep/toc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,9 @@ items:
588588
- name: What-if check
589589
href: deploy-what-if.md
590590
displayName: whatif, what if
591+
- name: Preflight check
592+
href: deploy-preflight.md
593+
displayName: preflight, pre-flight
591594
- name: Deploy - VS Code
592595
href: deploy-vscode.md
593596
displayName: visual studio code,vscode

articles/azure-resource-manager/troubleshooting/quickstart-troubleshoot-arm-deployment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This quickstart describes how to troubleshoot Azure Resource Manager template (A
1515
There are three types of errors that are related to a deployment:
1616

1717
- **Validation errors** occur before a deployment begins and are caused by syntax errors in your file. A code editor like Visual Studio Code can identify these errors.
18-
- **Preflight validation errors** occur when a deployment command is run but resources aren't deployed. These errors are found without starting the deployment. For example, if a parameter value is incorrect, the error is found in preflight validation.
18+
- **Preflight validation errors** occur when a deployment command is run but resources aren't deployed. These errors are found without starting the deployment. For example, if a parameter value is incorrect, the error is found in [preflight validation](../bicep/deploy-preflight.md).
1919
- **Deployment errors** occur during the deployment process and can only be found by assessing the deployment's progress in your Azure environment.
2020

2121
All types of errors return an error code that you use to troubleshoot the deployment. Validation and preflight errors are shown in the activity log but don't appear in your deployment history.

articles/azure-resource-manager/troubleshooting/quickstart-troubleshoot-bicep-deployment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This quickstart describes how to troubleshoot Bicep file deployment errors. You'
1313
There are three types of errors that are related to a deployment:
1414

1515
- **Validation errors** occur before a deployment begins and are caused by syntax errors in your file. A code editor like Visual Studio Code can identify these errors.
16-
- **Preflight validation errors** occur when a deployment command is run but resources aren't deployed. These errors are found without starting the deployment. For example, if a parameter value is incorrect, the error is found in preflight validation.
16+
- **Preflight validation errors** occur when a deployment command is run but resources aren't deployed. These errors are found without starting the deployment. For example, if a parameter value is incorrect, the error is found in [preflight validation](../bicep/deploy-preflight.md).
1717
- **Deployment errors** occur during the deployment process and can only be found by assessing the deployment's progress in your Azure environment.
1818

1919
All types of errors return an error code that you use to troubleshoot the deployment. Validation and preflight errors are shown in the activity log but don't appear in your deployment history. A Bicep file with syntax errors doesn't compile into JSON and isn't shown in the activity log.

0 commit comments

Comments
 (0)