Skip to content
Latchkey

az group create: Resource Groups & CI Errors

Create the resource group that holds your Azure resources.

az group create makes an Azure resource group - the container almost every other Azure resource lives in. CI scripts usually create it idempotently before deploying into it.

What it does

az group create --name <rg> --location <region> creates a resource group in the given Azure region. Resource groups are logical containers for billing, access control, and lifecycle. Re-running create with the same name and location is a no-op (it returns the existing group), so it is safely idempotent.

Common usage

Terminal
# Create a resource group
az group create --name my-rg --location eastus

# Idempotent guard in CI
az group exists --name my-rg \
  || az group create --name my-rg --location eastus

# Tag at creation
az group create --name my-rg --location eastus --tags env=prod team=ci

Common error in CI: invalid location / authorization failed

Creation fails with "The provided location \"east-us\" is not available" when the region name is malformed (use az account list-locations -o table for valid names like eastus, westeurope), or "AuthorizationFailed ... does not have authorization to perform action Microsoft.Resources/subscriptions/resourceGroups/write" when the principal lacks rights. Fix: pass a valid region short name, confirm the active subscription (az account show), and grant the service principal at least Contributor scoped to the subscription or a parent management group.

Key options

OptionPurpose
--name / -nResource group name
--location / -lAzure region (e.g. eastus)
--tagsKey=value tags
az group exists -n NAMEIdempotency check

Related guides

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