Azure Error: 'ResourceGroupNotFound: Resource group could not be found' — Cause, Fix, and Troubleshooting Guide
Fix Azure ResourceGroupNotFound: the resource group could not be found. Check the active subscription, exact name/casing, and that the group was not deleted.
- #azure
- #cloud
- #troubleshooting
- #errors
Stuck on this Azure with AI error? Get the free incident triage checklist
A one-page PDF — the exact steps to isolate, fix, and verify a production error like this one. No spam, unsubscribe anytime.
What this error means
Azure Resource Manager returns ResourceGroupNotFound when an operation targets a resource group name that does not exist in the currently-active subscription. Because resource groups are scoped to a single subscription, the most common reason is not a typo but a wrong active subscription. The literal error:
{
"error": {
"code": "ResourceGroupNotFound",
"message": "Resource group 'app-prod-rg' could not be found."
}
}
The name may be perfectly correct — it just does not exist in the subscription your CLI/SDK is currently pointed at.
What users report
az resource ...,az deployment group ..., or an SDK call fails withResourceGroupNotFoundfor a group you know exists.- The portal shows the group fine (you are viewing a different subscription there than the CLI is set to).
- A pipeline fails only in certain stages because those stages run under a different subscription/service connection.
- Terraform reports the group missing right after an
az account setto the wrong subscription.
Tenant and app configuration causes
- Wrong active subscription — the group exists, but in another subscription than the one currently selected.
- Name/casing mismatch — resource group names are case-insensitive for lookup but the value passed has a typo or extra whitespace.
- Group was deleted — someone (or a cleanup automation) deleted the group, or a whole subscription cleanup removed it.
- Region confusion — a resource group with a similar name exists in another region; but note groups are global metadata, so this is really a naming, not region, issue.
- Insufficient visibility — the identity cannot see the group (no read role), which for some paths surfaces as not-found rather than forbidden.
Confirming tenant configuration
Confirm which subscription is active, then check whether the group exists there:
az account show --query "{subscription:name, id:id}" -o table
az group exists --name app-prod-rg
az group exists returns true/false cleanly. If false, search across every subscription you can access:
for sub in $(az account list --query "[].id" -o tsv); do
echo "== $sub =="
az group list --subscription "$sub" \
--query "[?name=='app-prod-rg'].{name:name, location:location}" -o table
done
Whichever subscription lists the group is the one you should be targeting. Rule out casing/whitespace by listing groups with a fuzzy match:
az group list --query "[?contains(name,'app-prod')].name" -o table
Resolution
Point at the correct subscription and retry:
az account set --subscription "Production"
az group show --name app-prod-rg
Pass the subscription explicitly in scripts to avoid depending on ambient context:
az deployment group create \
--subscription <prod-subscription-id> \
--resource-group app-prod-rg \
--template-file main.bicep
Recreate the group if it was genuinely deleted (and redeploy its contents from IaC):
az group create --name app-prod-rg --location eastus
In CI/CD, verify the service connection/subscription used by the failing stage matches where the group lives; set it explicitly in the pipeline rather than relying on a default.
Avoiding tenant drift
- Default subscription drift. After
az loginwith multiple subscriptions, the default may not be the one you expect — always assert it in scripts withaz account set. - Not-found can mask forbidden. If you truly lack read access, some operations return not-found; check your role assignments if the group demonstrably exists in the active subscription.
- Deleted groups are unrecoverable. There is no undelete for a resource group; restore from IaC or backups, which is why hand-created groups are risky.
- Whitespace in variables. A trailing space or newline in a pipeline variable makes
app-prod-rgnot matchapp-prod-rg.
Related tenant errors
- ResourceNotFound — the individual-resource equivalent, with the same subscription/scope pitfalls.
- ParentResourceNotFound — a child resource requested before its parent exists.
- MissingSubscriptionRegistration — a resource provider not registered on the subscription.
Fixed it? Get 500 Azure with AI & DevOps AI prompts — free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.
Did this fix your issue?
Get 500 Battle-Tested DevOps AI Prompts — Free
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.