The Azure Hierarchy: Management Groups to Resource Groups
-
Phase 0: Before you start
-
Phase 1: The foundation
-
Phase 2: Day-to-day operations
-
Phase 3: Enterprise architecture
-
Phase 4: Troubleshooting step by step
-
Phase 5: Final project and career
Azure management groups sit at the top of a ladder that every Azure resource lives on: tenant, management groups, subscriptions, resource groups, resources. Anything you set high up, like a role or a policy, flows down to everything underneath.
If you get this ladder right, governance becomes easy, because one policy at the top keeps every team in India and one role gives the auditors read access everywhere. Get it wrong and you’ll be setting the same thing by hand in forty places.
You’ll build a small management group tree for the course, move your subscription into it, watch a role flow down from the top and protect a resource group with a lock.
| Time | You need | Cost | By the end you can |
|---|---|---|---|
| About 40 minutes | The Azure CLI, signed in as the account owner; the group from Lesson 5 | Nothing (management groups and locks cost nothing) | Build a management group tree, explain inheritance, and use resource locks without surprises |
What it is, in one line
Management groups are folders for subscriptions, so you set access and rules once at the top and they apply to everything below.
In Simple Words
School, building, classroom, desk
Think of a big school. There are rules for everyone, like “no phones in exams”, and each building can add its own, like “science labs need goggles”. Inside each building are classrooms full of desks, and each desk has a student’s books on it.
Azure is set up the same way: the tenant is the school, management groups are the buildings, subscriptions are the classrooms and resource groups are the desks holding the actual things, like VMs and disks. A rule made for the whole school reaches every desk without anyone walking round to repeat it.
Engineer's View
The ladder and its limits
- Tenant root group: created the first time anyone uses management groups. Its ID is the tenant ID, and it can’t be moved or deleted. By default nobody has access to it, but a Global Administrator can elevate to get User Access Administrator there.
- Management groups: you can have up to 10,000 per tenant, nested up to six levels deep (not counting the root and the subscription level). Each has an ID that never changes and a display name that can.
- Subscriptions: the boundary for billing and quotas. Every subscription, and every management group, has exactly one parent.
- Resource groups: each lives in one subscription and can’t be nested, and every resource belongs to exactly one of them. The group’s region only decides where its metadata is stored, so the resources inside can be in other regions.
Inheritance: Azure RBAC role assignments and Azure Policy assignments flow downwards, so Reader at a management group means Reader on every subscription, resource group and resource below it. Lower down you can’t block an inherited allow, you can only add more.
Resource locks flow down as well. CanNotDelete lets people change things but not delete them, while ReadOnly blocks every write, including a few actions that look like reads but are really POST calls, such as listing storage account keys.
Locks apply to Owners too, and that’s deliberate, because they’re there to stop mistakes as well as strangers.
Moving a subscription between management groups needs Owner on the subscription plus write access on both the old and the new parent, though moves to or from the root group skip the parent checks.
How it works, step by step
Lots of companies start with a simple layout along these lines:
- Platform: subscriptions for shared networking, identity and monitoring, run by the central IT team.
- Workloads: one subscription per app or team, with production and non-production kept apart so a mistake in test can’t reach production.
- Sandbox: playground subscriptions with a budget and relaxed rules, for learning and quick experiments.
Once you assign something at a level, Azure Resource Manager checks it on every request below that level. That’s how a policy on the top management group can block a VM in the wrong region even when the person creating it is Owner of their own subscription.
In the lab you’ll build that tree under a course management group, put your subscription into “Sandbox” and show that a role given at the top does reach the subscription.
Hands-on lab: build the tree, test inheritance, lock a group
Before you run any command, double-check it
Read every command twice before you press Enter. Check the target: the system or account, the IDs, the names and the sizes. These commands are for learning and were tested in our lab, not on your system. At work, run the read-only list commands first, follow your change process, make sure a backup exists, and ask a second person to check anything that changes or deletes data. You run them at your own risk.
You’ll create four management groups, move your subscription, test inheritance with a Reader role and then lock a resource group. The management group tree stays for later lessons, while the role, the lock and the resource group get cleaned up at the end.
1Create the management group tree
Run this:
$sub = az account show --query id -o tsv
az account management-group create --name mg-saatvedha --display-name "SaatVedha" -o none
foreach ($m in 'platform','workloads','sandbox') {
az account management-group create --name "mg-saat-$m" --display-name "SaatVedha $m" --parent mg-saatvedha -o none
}
az account management-group list --query "[?starts_with(name,'mg-saat')].{name:name, display:displayName}" -o tableYou should see something like this:
Name Display
----------------- ------------------
mg-saatvedha SaatVedha
mg-saat-platform SaatVedha platform
mg-saat-sandbox SaatVedha sandbox
mg-saat-workloads SaatVedha workloadsThe first command can take a minute, because if this is your tenant’s first management group, Azure also sets up the Tenant root group behind the scenes and puts your subscription under it.
2Move your subscription into Sandbox
Run this:
az account management-group subscription add --name mg-saat-sandbox --subscription $sub
az account management-group show --name mg-saatvedha --expand --recurse --query "children[].{group:displayName, inside:children[].displayName}" -o jsonYou should see something like this:
[
{
"group": "SaatVedha platform",
"inside": null
},
{
"group": "SaatVedha sandbox",
"inside": [
"Azure subscription 1"
]
},
{
"group": "SaatVedha workloads",
"inside": null
}
]Your subscription now sits at Tenant root group → SaatVedha → SaatVedha sandbox, and anything you assign at those levels reaches it.
3Prove inheritance with a Reader role
Give the helpdesk group from Lesson 5 Reader on the Sandbox management group rather than on the subscription, and then ask the subscription who can read it.
Run this:
$grp = az ad group show --group grp-saat-helpdesk --query id -o tsv
az role assignment create --assignee-object-id $grp --assignee-principal-type Group --role Reader --scope /providers/Microsoft.Management/managementGroups/mg-saat-sandbox -o none
az role assignment list --scope "/subscriptions/$sub" --include-inherited --query "[?principalId=='$grp'].{who:principalName, role:roleDefinitionName, from:scope}" -o tableYou should see something like this:
Who Role From
----------------- ------ ------------------------------------------------------------
grp-saat-helpdesk Reader /providers/Microsoft.Management/managementGroups/mg-saat-sandboxThe subscription shows the role even though it was given two levels higher. If you like, sign in as Asha in a private window, and you’ll see she can now view “Azure subscription 1” and its resource groups, read-only.
It may take a few minutes to show up.
Now remove it again, since Lesson 7 covers roles properly:
az role assignment delete --assignee $grp --role Reader --scope /providers/Microsoft.Management/managementGroups/mg-saat-sandbox4Create a resource group and lock it
Run this:
az group create --name rg-saat-l06 --tags course=saatvedha-azure lesson=06 -o none
az lock create --name lock-no-delete --lock-type CanNotDelete --resource-group rg-saat-l06 --notes "Course lab: protect from delete" -o none
az lock list --resource-group rg-saat-l06 --query "[].{name:name, level:level, notes:notes}" -o tableYou should see something like this:
Name Level Notes
-------------- ------------ ------------------------------
lock-no-delete CanNotDelete Course lab: protect from delete
✅ Checkpoint: Your subscription is under mg-saat-sandbox, the Reader role has been removed and rg-saat-l06 has a CanNotDelete lock. Leave the lock in place for “Break It”.
Break It, Then Fix It
Locks do what they say, and that tends to surprise people at the worst possible moment. Here are both kinds.
1Break it: delete a locked resource group
Run this:
az group delete --name rg-saat-l06 --yesYou’ll get an error like this:
(ScopeLocked) The scope '/subscriptions/6f1c2d3e-.../resourcegroups/rg-saat-l06' cannot perform delete operation
because following scope(s) are locked: '/subscriptions/6f1c2d3e-.../resourceGroups/rg-saat-l06'.
Please remove the lock and try again.
Code: ScopeLockedYou’re the Owner and it still said no, because the lock is checked before RBAC even comes into it. The error names the scope holding the lock, which might be higher up than the thing you’re trying to delete.
2Break it: a ReadOnly lock that blocks more than you expect
Replace the lock with a ReadOnly one and then try adding a tag:
az lock delete --name lock-no-delete --resource-group rg-saat-l06
az lock create --name lock-read-only --lock-type ReadOnly --resource-group rg-saat-l06 -o none
az group update --name rg-saat-l06 --set tags.owner=Priya -o noneYou’ll get an error like this:
(ScopeLocked) The scope '/subscriptions/6f1c2d3e-.../resourcegroups/rg-saat-l06' cannot perform write operation
because following scope(s) are locked: '/subscriptions/6f1c2d3e-.../resourceGroups/rg-saat-l06'.
Please remove the lock and try again.
Code: ScopeLockedAdding a tag counts as a write, and so do starting a VM, taking a disk snapshot and listing storage account keys (a POST request). That’s why ReadOnly locks on production break backups and deployments in ways nobody sees coming.
To fix it, remove the lock and then clean up:
az lock delete --name lock-read-only --resource-group rg-saat-l06
az group delete --name rg-saat-l06 --yes
C:\azure-lab\Find-LabResources.ps1You should see this:
Nothing tagged course=saatvedha-azure is left.
✅ Checkpoint: You’ve reproduced both lock errors, the resource group is gone and the management group tree is still there.
This happened at work
The audit freeze that stopped the backups
Ahead of its yearly audit, a finance company wanted to be sure nobody “changed anything” in production for two weeks, so someone put a ReadOnly lock on every production resource group. On paper it looked neat and safe.
The next morning they found the night’s VM backups had failed, because Azure Backup couldn’t write snapshots. The deployment pipeline broke too, since it listed storage account keys, which is a POST call and counts as a write. On day three a VM that needed restarting after a crash couldn’t be started, and the audit ended up opening with an incident review instead of the quiet week everyone wanted.
What they changed: production groups now get CanNotDelete locks only, which block deletes but let normal work carry on. Change freezes are handled through Azure Policy and PIM approval for higher roles instead of ReadOnly locks, and any new lock is announced in the operations channel with the backup and pipeline owners tagged.
Common mistakes and troubleshooting
| Mistake | What you see | What to do |
|---|---|---|
| ReadOnly lock on production | Backups, VM starts and deployments fail with ScopeLocked | Use CanNotDelete, and use Policy and PIM for change control. |
| Giving roles on each subscription one by one | Dozens of assignments to review | Assign it once at a management group. |
| Expecting a lower level to block an inherited role | The user still has access | Inherited allows can’t be blocked further down, so assign at the right level. |
| Using the display name in commands | Management group not found | Use the ID (the name you chose) rather than the display name. |
| Thinking a resource group’s region limits its resources | Resources in other regions inside it | The group’s region only stores metadata, so use Policy if you want to limit regions. |
| Deleting a resource “under” a lock higher up | ScopeLocked on a resource you didn’t lock | The error names the locked scope, so check the parent groups and subscriptions. |
Interview questions
Click a question to open it. Each one is phrased the way an interviewer would ask it, and underneath you’ll find why they ask it and one way to answer in your own words.
Fresher level
1. Can you walk me through the Azure resource hierarchy?
Why they ask this: It’s a core concept, and they expect every admin to explain it clearly.
How you might answer: Starting at the top, there’s the Entra tenant, then the Tenant root group, then management groups, which hold subscriptions. Each subscription holds resource groups, and each resource group holds the actual resources like VMs and storage accounts.
Anything you set at a higher level, roles or policies, is inherited by everything below it.
2. What is the difference between CanNotDelete and ReadOnly locks?
Why they ask this: They want to hear the practical effect, and knowing the names isn’t enough.
How you might answer: CanNotDelete lets people read and change a resource but stops deletes. ReadOnly blocks every write, which covers things like starting a VM or listing storage keys, so it often breaks normal operations.
I put CanNotDelete on important production resources and steer clear of ReadOnly unless there’s a very specific reason for it.
3. Why would a company use more than one subscription?
Why they ask this: They want reasons linked to billing, limits and safety.
How you might answer: Subscriptions separate billing, quotas and access. Keeping production apart from test means a mistake in test, or a test admin, can’t touch production, and each team’s cost is easy to see.
Some limits apply per subscription as well, so big companies spread their workloads to stay inside them.
2–5 years experience
4. You assigned Reader at a management group, but a user says they can’t see a subscription. What do you check?
Why they ask this: They want a methodical access check that takes propagation and the hierarchy into account.
How you might answer: I’d first make sure the subscription really is under that management group, using az account management-group show --expand --recurse. Then I’d check the user is in the group that got the role and that enough time has gone by, because new assignments and group changes can take a few minutes.
I’d also get them to sign out and back in, and check they’re looking at the right directory in the portal.
5. How would you organise management groups for a company with three business units and production and test environments?
Why they ask this: They’re checking your design sense, so the tree is neither too deep nor too flat.
How you might answer: I’d keep it shallow, with a top company group and under it Platform for shared services, Landing zones split into Production and Non-production, and a Sandbox. Business units would be separate subscriptions or tags instead of extra levels, unless they need different policies.
Any policies that differ between production and test then go on those two groups.
6. A colleague can’t delete an empty resource group even though they’re Owner. What’s going on?
Why they ask this: They want to see you think of locks before RBAC.
How you might answer: Most likely there’s a lock, either on the group or higher up on the subscription, and the ScopeLocked error names the scope holding it. I’d check with az lock list, talk to whoever owns the lock and remove it if it’s not needed any more.
Senior level
7. What are the risks of moving a subscription to a different management group?
Why they ask this: They want to know you realise inheritance changes the moment you move it.
How you might answer: Everything inherited changes, so the old group’s policies and roles stop applying and the new group’s kick in. That can take away access people depend on, or bring in deny policies that block deployments that worked fine yesterday.
Before a move I compare the role and policy assignments on both parents, let the affected teams know and do it at a quiet time.
8. How do you protect critical production resources from accidental deletion without slowing the team down?
Why they ask this: They want controls in layers that still let normal work go on.
How you might answer: I’d put CanNotDelete locks on the critical resource groups, keep Owner to a small number of people and use PIM so even admins only activate higher roles for a short time. Backups with soft delete cover anything that slips through.
I’d also make lock removal part of a documented change, so it’s visible whenever someone does it.
9. Someone wants to give an external auditor read access to everything in Azure. How would you do it?
Why they ask this: They’re checking least privilege, sensible use of high scopes and guest identities.
How you might answer: I’d invite the auditor as a guest in Entra ID, add them to an auditors group and assign Reader on the top company management group, which covers every subscription. If they don’t need data access, Reader is enough, and I’d keep away from any role that can read secrets or keys.
I’d set an end date with an access review and take the role away when the audit’s over.
Quick quiz
Q1. What is the ID of the Tenant root group?
- mg-root
- The subscription ID
- The tenant ID
- The domain name
Show answer
C — The root management group’s ID is the Microsoft Entra tenant ID.
Q2. You give Reader at a management group. Who gets it?
- Only the management group
- Every subscription, resource group and resource below it
- Only new resources
- Only Owners
Show answer
B — Role assignments are inherited by everything below.
Q3. Which lock still allows changes but blocks deletes?
- ReadOnly
- CanNotDelete
- NoChange
- Freeze
Show answer
B — CanNotDelete blocks deletes only.
Q4. Why can a ReadOnly lock break a deployment that only lists storage keys?
- Keys are deleted
- Listing keys is a POST, which counts as a write
- ReadOnly locks block reads
- The lock expires
Show answer
B — Some read-like actions are POST calls, which ReadOnly blocks.
Q5. How many levels deep can management groups go?
- Three
- Six (not counting root and subscriptions)
- Ten
- No limit
Show answer
B — Up to six levels below the root.
Quick recap
You now have a small governance tree and you understand how settings and locks flow down through it.
- Tenant → root group → management groups → subscriptions → resource groups → resources.
- Roles, policies and locks set high up are inherited further down.
- In commands, use management group IDs rather than display names.
- CanNotDelete stops deletes, while ReadOnly stops every write, including some that look like reads.
- Your subscription now lives in mg-saat-sandbox, and the tree stays in place for later lessons.
Next lesson
Lesson 7: Azure RBAC: roles, scopes and role assignments → You’ll give Asha exactly the access she needs at the right scope, and prove it by signing in as her.
Further reading: Azure management groups
If you want to go further with Azure management groups, read Microsoft’s What are Azure management groups? and Lock your resources to protect your infrastructure. The full plan for this course is on the Azure Cloud Administration course page.
