IntermediateLesson 7 of 16

Deployment Scopes: MG, Subscription, RG

Deploy at management-group, subscription, and resource-group scopes.

What is it? (Simple Explanation)

Bicep is Azure Infrastructure as Code that compiles to ARM templates while remaining readable for teams. This lesson focuses on deployment scopes: mg, subscription, rg in real delivery.

Why do we need it?

How it works (Technical)

Bicep declares desired resource state and Azure Resource Manager orchestrates deployment with dependency resolution and idempotent updates.

Bicep Deployment Flow
Bicep Code
Build + Validate
Deploy
Azure

Hands-on

bicep
targetScope = 'subscription'
resource rg 'Microsoft.Resources/resourceGroups@2024-03-01' = {
  name: 'rg-app-dev'
  location: 'eastus'
}
  1. Author or update template for this lesson objective.
  2. Run build and validate commands.
  3. Run what-if preview before deploy.
  4. Deploy and verify resulting resources.

Debugging Scenario

Failure: Authorization errors happen when identity is scoped only at resource group.

Interview Questions

Beginner

What does this lesson teach at a basic level?

It teaches practical Bicep usage with clear deployment reasoning.

Why Bicep over manual portal changes?

Because Bicep is repeatable, auditable, and reviewable.

What is the role of parameters?

They make templates reusable per environment.

Why validate before deployment?

To catch structural issues early.

What is a common first troubleshooting step?

Check deployment operation details in Azure.

Intermediate

How does this topic support platform engineering?

It standardizes repeatable Azure infrastructure delivery patterns.

When should this pattern be modularized?

When ownership or reuse boundaries emerge clearly.

How do permissions influence outcomes?

Insufficient RBAC often causes runtime deployment failures.

How does this connect to AKS and CI/CD modules?

Bicep provisions foundations consumed by AKS operations and release pipelines.

Why use what-if in real projects?

To review impact before mutating production resources.

Scenario-based

Dev passes but prod fails. What do you compare?

Compare parameters, RBAC, policy, and quota differences.

How do you minimize configuration drift?

Enforce IaC-only changes with reviews and checks.

When would Terraform be a better fit?

When multi-cloud consistency is a core requirement.

How do you design safe production rollout?

Validate, run what-if, require approvals, then deploy.

What proves practical experience in interviews?

Explaining real failure triage and design tradeoffs clearly.

Real-world Usage

Enterprise teams deploy policy at higher scopes and workloads at resource-group scope.

Summary

This lesson strengthens your Bicep delivery capability from concept to production-safe implementation.