DEV Community

iapilgrim
iapilgrim

Posted on

Phase 1: Preparing Azure CLI for Production AKS (Region: East US 2)

Before deploying a production-grade AKS cluster, you must properly configure Azure CLI, subscription settings, networking, and identity.

This guide walks through the exact foundational steps used by platform engineers when building AKS in eastus2.


🎯 Goal of Phase 1

By the end of this phase, you will have:

  • Azure CLI installed and configured
  • Subscription properly selected
  • Default region set to eastus2
  • Resource Group created
  • Virtual Network + Subnet created
  • Managed Identity created
  • Required Azure resource providers registered

This sets the stage for production AKS deployment.


πŸ›  Step 1 β€” Install Azure CLI

On Ubuntu / WSL:

curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
Enter fullscreen mode Exit fullscreen mode

Verify installation:

az version
Enter fullscreen mode Exit fullscreen mode

You are now ready to manage resources in:

  • Microsoft Azure

πŸ” Step 2 β€” Authenticate

az login
Enter fullscreen mode Exit fullscreen mode

This authenticates via:

  • Microsoft Entra ID

List available subscriptions:

az account list --output table
Enter fullscreen mode Exit fullscreen mode

Set your working subscription:

az account set --subscription "<SUBSCRIPTION_ID>"
Enter fullscreen mode Exit fullscreen mode

Confirm:

az account show --output table
Enter fullscreen mode Exit fullscreen mode

🌍 Step 3 β€” Set Default Region to East US 2

Instead of specifying --location every time:

az configure --defaults location=eastus2
Enter fullscreen mode Exit fullscreen mode

Verify available regions:

az account list-locations --output table
Enter fullscreen mode Exit fullscreen mode

Now all new resources default to:

eastus2
Enter fullscreen mode Exit fullscreen mode

πŸ“¦ Step 4 β€” Create Resource Group

Resource Groups logically organize infrastructure.

az group create \
  --name aks-east2-rg
Enter fullscreen mode Exit fullscreen mode

Verify:

az group show --name aks-east2-rg --output table
Enter fullscreen mode Exit fullscreen mode

🌐 Step 5 β€” Create Production Networking (VNet + Subnet)

We prepare networking before creating AKS.

az network vnet create \
  --resource-group aks-east2-rg \
  --name aks-vnet \
  --address-prefix 10.0.0.0/8 \
  --subnet-name aks-subnet \
  --subnet-prefix 10.240.0.0/16
Enter fullscreen mode Exit fullscreen mode

This creates:

  • Virtual Network
  • Subnet dedicated for AKS

This integrates later with:

  • Azure Virtual Network

πŸ” Step 6 β€” Create Managed Identity

Modern AKS uses Managed Identity instead of Service Principals.

az identity create \
  --resource-group aks-east2-rg \
  --name aks-mi
Enter fullscreen mode Exit fullscreen mode

Capture:

  • principalId
  • clientId
  • id

This identity will later allow AKS to manage networking and cloud resources securely.


🚨 Step 7 β€” Register Required Resource Providers

When enabling monitoring later, many users hit this error:

MissingSubscriptionRegistration:
Microsoft.OperationalInsights
Enter fullscreen mode Exit fullscreen mode

This happens because new subscriptions do not automatically register all providers.

Register them once:

az provider register --namespace Microsoft.OperationalInsights
az provider register --namespace Microsoft.ContainerService
az provider register --namespace Microsoft.Network
az provider register --namespace Microsoft.Compute
Enter fullscreen mode Exit fullscreen mode

Verify registration:

az provider show \
  --namespace Microsoft.OperationalInsights \
  --query registrationState
Enter fullscreen mode Exit fullscreen mode

Wait until:

Registered
Enter fullscreen mode Exit fullscreen mode

Why this matters:

Monitoring uses:

  • Azure Monitor
  • Log Analytics

Which depend on the Microsoft.OperationalInsights namespace.

This step prevents AKS deployment failures later.


🧠 What You Learned in Phase 1

You now understand:

  • Azure subscription context management
  • Default region configuration
  • Azure networking basics for AKS
  • Managed identity creation
  • Azure provider registration mechanics
  • Why monitoring requires Operational Insights

Most AKS failures in real environments happen because Phase 1 was skipped or done incorrectly.

You’ve now built a clean, production-ready foundation.


πŸ— Current Architecture State

Subscription
β”‚
└── Resource Group: aks-east2-rg
    β”œβ”€β”€ Virtual Network: aks-vnet
    β”‚   └── Subnet: aks-subnet
    └── Managed Identity: aks-mi
Enter fullscreen mode Exit fullscreen mode

No Kubernetes cluster yet β€” just solid groundwork.


⏭ What’s Next?

In Phase 2, we will:

  • Attach AKS to existing VNet
  • Use Azure CNI
  • Assign network roles to Managed Identity
  • Enable OIDC & Workload Identity
  • Enable Monitoring
  • Deploy a production-ready cluster

Top comments (0)