This converts myTemplate.bicep into myTemplate.json, which is then processed by Azure Resource Manager.
Key aspects of the compilation process:
✅ Syntax validation – Ensures there are no errors in the Bicep template
✅ Execution of compile-time functions – Functions like readEnvironmentVariable() are processed
✅ External module retrieval – If your template references Azure Verified Modules (AVM), they are fetched and cached
Handling network restrictions
If you are using a private build agent (e.g., in a restricted Azure DevOps environment), ensure that external module sources like mcr.microsoft.com are allowlisted to prevent deployment failures.
Why is compilation important?
• Ensures Bicep templates are correctly translated
• Validates syntax before deployment begins
• Handles module dependencies automatically
After successful compilation, the runtime stage begins.
3. Execution – Deploying Resources to Azure
Once the Bicep template has been converted into an ARM JSON template, Azure Resource Manager (ARM) takes over the deployment process. This involves:
1. Validating the compiled template to ensure correctness
2. Deploying resources based on defined dependencies
3. Managing concurrency for efficient execution
How ARM Handles Dependencies
Azure Resource Manager ensures resources are deployed in the correct order using explicit or implicit dependencies.
Example: Implicit Dependency Management
In the following example, an Azure Key Vault is deployed first, followed by a storage account that references the Key Vault’s ID. Even though there is no explicit dependsOn statement, Azure Resource Manager (ARM) automatically detects the dependency based on the reference to resKeyVault.id.