Skip to content
Latchkey

az aks create: Provision an AKS Cluster

az aks create provisions a managed AKS cluster with the node pool, identity, and add-ons you specify.

Standing up an ephemeral cluster for integration tests is a common pipeline task. aks create with a managed identity and ACR attach gets you a pull-capable cluster in one call.

What it does

az aks create provisions a control plane and an initial node pool in the named resource group. With --enable-managed-identity it uses a system-assigned identity, and --attach-acr grants that identity AcrPull on a registry so the cluster can pull private images.

Common usage

Terminal
az aks create \
  --resource-group rg-app --name aks-ci \
  --node-count 2 --node-vm-size Standard_B2s \
  --enable-managed-identity \
  --attach-acr myregistry \
  --generate-ssh-keys

Subcommands and flags

FlagWhat it does
--resource-group, -gResource group for the cluster
--name, -nCluster name
--node-countNumber of nodes in the default pool
--node-vm-sizeVM SKU for the nodes
--enable-managed-identityUse a managed identity for the cluster
--attach-acr <name>Grant AcrPull on a registry to the cluster
--generate-ssh-keysCreate SSH keys if none are provided

In CI

Cluster creation takes minutes; for fast pipelines prefer a long-lived cluster and only run aks create for nightly end-to-end jobs. --attach-acr at create time avoids a separate role assignment step for image pulls.

Common errors in CI

"QuotaExceeded" or "Operation could not be completed as it results in exceeding approved ... quota" means the region or VM family has no headroom; pick another size or region. "InsufficientSubscriptionPermissions" or "does not have authorization to perform action 'Microsoft.ContainerService/managedClusters/write'" means the identity lacks Contributor. SSH key errors clear with --generate-ssh-keys.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →