AzureIaC5 Min Read

Azure Resource Group: CLI vs Terraform

Comparing Imperative and Declarative approaches for foundational Azure management.

1

The Imperative Way (Azure CLI)

Fast and efficient for one-off tasks. Use the az group create command to provision your RG immediately.

# Login to your Azure Account
az login

# Create Resource Group
az group create --name RG-Network-Dev --location eastus

# Verify
az group list -o table
2

The Declarative Way (Terraform)

Essential for production. Define your state and let Terraform manage the lifecycle of your resources.

provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "main" {
  name     = "RG-Production-Network"
  location = "Central US"
  
  tags = {
    Environment = "Production"
    Owner       = "DevdasMahato"
  }
}
3

Initialize & Apply

Run these standard commands to bring your infrastructure to life.

terraform init
terraform plan
terraform apply -auto-approve

Architect Choice

"I prefer Terraform for 99% of my work. It allows me to perform 'Drift Detection'—if someone manually changes an RG setting, Terraform will flag it, whereas CLI just fires and forgets."