What you will learn in this TP
- Write a parameterised Bicep module
- Validate with bicep build, lint and rules
- Preview with what-if and deploy
Introduction #
What you will learn in this section
- Write a parameterised Bicep module
- Validate with bicep build, lint and rules
- Preview with what-if and deploy
Context. The team wants every environment described as code and checked before deployment. You write and test the template locally.
Prerequisites: Azure CLI with Bicep (az bicep install); PSRule for Azure optional; a trial subscription only for the last two steps · Estimated time: 45 min
Hands-on #
Guided steps, with their solution.
1. Write the template
Why? Decorators (@allowed, @minLength) reject bad values before any deployment.
Createmain.bicep: ZRS storage in production and LRS otherwise, public access disabled, Linux App Service plan and outputs.2. Compile and analyse
Why? The linter flags bad practices (secrets in outputs, old API versions, hard-coded locations).
Compile to ARM JSON, run the linter and inspect the generated JSON.3. Test security rules
Why? PSRule for Azure checks the template against the Well-Architected Framework without any subscription.
Analyse the template with PSRule (container) and fix a warning if needed.4. Preview and deploy (trial subscription)
Why? What-if shows exactly what will change; a second identical deployment changes nothing (idempotence).
Create a group, run what-if, deploy, run what-if again then delete the group.
Difficulty level : ●●●○○ (3/5)
My progress
Sign in to track your progress and take notes. Sign in
💬 Questions about this lesson
No questions yet: be the first to ask for help or share your configuration.
Recommended Articles
Infrastructure as Code on Azure: Bicep, Terraform, Cost Management and Well-Architected
Describe and deploy Azure as code with Bicep (modules, parameters, what-if, pipeline deployments)...
Compute on Azure: virtual machines, App Service, Functions and containers
Choose and use Azure compute: virtual machines and scale sets (VMSS), App Service, Azure Function...
Azure storage: storage accounts, Blob, Files, disks and redundancy
Store data on Azure: storage accounts, Blob (hot, cool, archive tiers, lifecycle), Files, Queue a...
Terraform modules: designing, versioning and reusing
Structure Terraform with modules: root module and child modules, inputs and outputs, sources (loc...
Testing and securing Terraform: validate, terraform test, tflint, Checkov and policies
Ensure the quality of Terraform code: fmt and validate, native terraform test tests with mocked p...
Terraform in CI/CD: pipelines, plan review, OIDC and GitOps
Automate Terraform: plan pipeline on merge requests and apply after approval, posting the plan as...
Azure best practices: landing zone, security, reliability and costs
Best practices for running Azure in production: landing zone and management groups, identities an...
Terraform across multiple clouds: AWS, Azure, Google Cloud, OVHcloud and Kubernetes
Use Terraform with the main providers: aws, azurerm, google, ovh and openstack, kubernetes and he...
Preparing for the Azure Administrator Associate certification (AZ-104)
Preparation guide for the AZ-104: format, the five domains (identities and governance, storage, c...