Skip to content
Latchkey

az group create: Provision Resource Groups in CI

Create an Azure resource group in a given region.

az group create provisions a resource group, the container for all other Azure resources. In CI it is often the first infra step or a guard before deploying. The command is idempotent in practice: re-running with the same name and location succeeds.

Common flags

  • -n NAME - the resource group name
  • -l LOCATION - region, e.g. eastus
  • --tags KEY=VALUE - apply tags at creation

Example in CI

Create or confirm a resource group with tags.

shell
az group create \
  -n my-rg -l eastus \
  --tags env=ci sha=${GITHUB_SHA::7}

Common errors in CI

  • LocationNotAvailableForResourceGroup - invalid or misspelled region
  • AuthorizationFailed: ... does not have authorization ... write - SP lacks Contributor on the subscription
  • MissingSubscription - no active subscription selected after login

Key takeaways

  • Creates the resource group that holds all other Azure resources.
  • Re-running with the same name and location is effectively idempotent.
  • Requires Contributor on the subscription and a valid region string.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →