RousselTMLEARNING

Article · Microsoft Azure: from discovery to expertise

Bicep, Terraform and cost control

1. Bicep #

The native language of Azure infrastructure.

Example #

Bicep deployment cycle
Bicep compiles to an ARM JSON template; the state is what exists in Azure, with no state file to manage.
param location string = resourceGroup().location
@allowed(['recette', 'prod'])
param env string

resource stockage 'Microsoft.Storage/storageAccounts@2023-05-01' = {
  name: 'st${env}${uniqueString(resourceGroup().id)}'
  location: location
  sku: { name: env == 'prod' ? 'Standard_ZRS' : 'Standard_LRS' }
  kind: 'StorageV2'
  properties: {
    minimumTlsVersion: 'TLS1_2'
    allowBlobPublicAccess: false
    supportsHttpsTrafficOnly: true
  }
  tags: { env: env }
}

output nomStockage string = stockage.name
az bicep build --file main.bicep                 # compile et vérifie
az bicep lint --file main.bicep
az deployment group what-if -g rg-app --template-file main.bicep --parameters env=recette
az deployment group create -g rg-app --template-file main.bicep --parameters env=recette

2. Terraform and pipelines #

Alternatives and automation.

Choosing #

ToolStrengths
BicepNative, stateless, immediate support for new Azure features
Terraform (azurerm)Multi-cloud, module ecosystem, explicit state
Azure Verified ModulesOfficial reusable modules in Bicep and Terraform

Deploy through GitHub Actions or Azure Pipelines with a federated identity (OIDC): no secrets stored in CI.

3. Costs and frameworks #

Cost Management, CAF, WAF.

Rules #

  • Cost Management: analysis by tag, budgets and alerts, exports.
  • Advisor: right-sizing and reservation recommendations.
  • Cloud Adoption Framework: strategy, plan, landing zones, governance.
  • Well-Architected Framework: reliability, security, costs, operational excellence, performance.
Good practice: An Azure landing zone (the CAF reference model) sets up management groups, policies and a hub network before hosting applications.

📄 Infrastructure as Code on Azure: Bicep, Terraform, Cost Management and Well-Architected →

My progress

  • ⏱ Estimated time : ≈ 5 min

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.

Ask a question about this lesson →

Recommended Articles

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...

Microsoft Entra ID, RBAC and Azure Policy: identities, permissions and governance

Manage identities and access on Azure: Microsoft Entra ID (users, groups, MFA, conditional access...

Preparing for the Microsoft Azure Fundamentals certification (AZ-900)

Preparation guide for the AZ-900: format, the three domains and their weightings, notions to mast...

Azure networking: VNet, NSG, peering, load balancing and hybrid connectivity

Design networking on Azure: virtual networks and subnets, network security groups (NSG), peering ...

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...

Databases on Azure: Azure SQL, Cosmos DB, PostgreSQL and cache

Choose a managed database on Azure: Azure SQL Database and Managed Instance, Azure Database for P...

Monitoring and protecting Azure: Monitor, Log Analytics, Defender, Key Vault and Backup

Operate Azure: Azure Monitor (metrics, activity logs, alerts), Log Analytics and KQL, Application...

Preparing for the Azure Administrator Associate certification (AZ-104)

Preparation guide for the AZ-104: format, the five domains (identities and governance, storage, c...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!