Skip to content
Latchkey

az deployment sub create: Subscription Deploys

az deployment sub create deploys a template at subscription scope, where resource groups themselves can be created.

Some templates provision resource groups or subscription-level policy. Those run at sub scope, which requires a --location for the deployment metadata.

What it does

az deployment sub create deploys a template scoped to the whole subscription rather than one resource group. Because there is no group to anchor it, you must pass --location for the deployment record. It is the scope used to create resource groups from Bicep.

Common usage

Terminal
az deployment sub create \
  --location eastus \
  --template-file subscription.bicep \
  --parameters @groups.parameters.json
# preview a subscription-scope change
az deployment sub what-if \
  --location eastus --template-file subscription.bicep

Subcommands and flags

FlagWhat it does
--location, -lRegion for the deployment metadata (required)
--template-fileSubscription-scope Bicep or ARM template
--parametersInline or @file parameters
--what-ifPreview without applying
--name, -nName the deployment for later lookup

In CI

Use sub scope to bootstrap an environment: create the resource group and shared resources in one template, then deploy app resources with az deployment group create. The federated identity needs Contributor at subscription scope, which is broader than group scope, so scope the role assignment carefully.

Common errors in CI

"the following arguments are required: --location/-l" means you omitted the mandatory location at sub scope. "AuthorizationFailed" at subscription scope means the identity has group Contributor but not subscription Contributor. "InvalidDeploymentLocation" means a deployment of that name already exists in a different region.

Related guides

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