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
Recommended Articles
Infrastructure as Code sur Azure : Bicep, Terraform, Cost Management et Well-Architected
Décrire et déployer Azure en code avec Bicep (modules, paramètres, what-if, déploiements par pipe...
Le calcul sur Azure : machines virtuelles, App Service, Functions et conteneurs
Choisir et utiliser le calcul Azure : machines virtuelles et groupes identiques (VMSS), App Servi...
Les modules Terraform : concevoir, versionner et réutiliser
Structurer Terraform avec des modules : module racine et modules enfants, entrées et sorties, sou...
Le stockage Azure : comptes de stockage, Blob, Files, disques et redondance
Stocker des données sur Azure : comptes de stockage, Blob (niveaux chaud, froid, archive, cycle d...
Tester et sécuriser Terraform : validate, terraform test, tflint, Checkov et politiques
Garantir la qualité du code Terraform : fmt et validate, tests natifs terraform test avec fournis...
Terraform en CI/CD : pipelines, revue du plan, OIDC et GitOps
Automatiser Terraform : pipeline plan sur demande de fusion et apply après approbation, publicati...
Bonnes pratiques Azure : landing zone, sécurité, fiabilité et coûts
Les bonnes pratiques pour exploiter Azure en production : landing zone et groupes d'administratio...
Le langage HCL : ressources, variables, sorties, données et expressions
Écrire du Terraform : blocs terraform, provider, resource et data, variables typées avec validati...
Préparer la certification Microsoft Azure Fundamentals (AZ-900)
Guide de préparation à l'AZ-900 : format, trois domaines et leurs pondérations, notions à maîtris...