MOFAKH.COM
← Back to profile
Azure Fundamentals

How Azure is organized: tenants, subscriptions, resource groups and resources

Nov 20, 202618 min readWritten

Every single thing in Azure sits at the bottom of a five-level hierarchy: tenant, management groups, subscriptions, resource groups, resources. Each level exists for a reason (identity, governance, billing, lifecycle) and settings flow downward through all of them. This part builds the hierarchy level by level, then covers resource IDs, tags, locks, naming, and how to lay out a real project.

This is the second part of the Azure series. Part 1 was about clouds in general. This part answers the first Azure-specific question: when you create a storage account or a web app, where does it live, who pays for it, and who is allowed to touch it?

The answer is a hierarchy, and it is worth learning properly now because almost every confusing Azure moment later ("why can't I see that resource?", "why is this on that invoice?", "why can't I delete this?") is really a question about where something sits in it.

The hierarchy at a glance

The Azure hierarchy, top to bottom
Tenant
the organization's identity directory (Entra ID)
contains
Management groups
optional folders for governing many subscriptions
contain
Subscriptions
the billing and access boundary
contain
Resource groups
folders of resources that live and die together
contain
Resources
the actual things: a storage account, a web app, a database

Each level answers a different question:

LevelThe question it answersAnalogy
Tenantwho are the people and apps in this organization?the company's staff directory
Management groupwhich rules apply to this whole group of subscriptions?a division of the company
Subscriptionwho pays, and what are the limits?a department's budget and bank account
Resource groupwhich things belong to the same project and get deleted together?a project folder
Resourcewhat is the actual thing?a single file in the folder

The rest of this part walks the hierarchy from top to bottom.

Level 1: the tenant

The top of the hierarchy is not really part of Azure at all. It is the organization's tenant in Microsoft Entra ID: the directory holding every user, group and application identity the organization has. The Azure Identity series covers tenants in depth; the one fact needed here is the relationship:

  • A subscription trusts exactly one tenant. Every subscription is linked to a single tenant, and only identities from that tenant (plus guests invited into it) can be given access to the subscription's resources.
  • A tenant can have many subscriptions. A company typically has one tenant and anywhere from one to hundreds of subscriptions.

So the tenant answers who can be given access. The levels below decide what they get access to.

Note to self
When you sign up for Azure with a personal account, Azure quietly creates a tenant for you, named after your account, and puts your first subscription in it. That is why even a one-person learning account has a "Default Directory" in Entra.

When companies merge: one tenant or two?

"One company, one tenant" is the simple case. A common real-world twist: company A buys company B, and people at B start saying "we're in A's tenant now". Where does B fit?

On the day the deal closes, nothing in Azure changes. The acquisition is a business event that Azure knows nothing about, so there are simply two tenants, each with its own users, apps and subscriptions. Mergers and acquisitions are one of the most common reasons Microsoft gives for an organization ending up with several tenants. What happens next is a choice, and there are three common outcomes, often done in this order over months or years.

1. Keep two tenants and connect them. People from one tenant are invited into the other as guests (Entra B2B collaboration): a guest signs in with their home account and is given access to resources in the other tenant. For a large organization, cross-tenant synchronization creates and updates those guest accounts automatically, and Entra's multitenant organization features make several tenants behave more like one company. Many organizations stay in this state for a long time.

2. Move the people into tenant A. B's employees get accounts in tenant A, and B's old tenant is eventually retired. A tenant can own many domain names (up to 5,000), so tenant A adds companyb.example as a verified domain and B's people keep their familiar addresses. A domain can only be verified in one tenant at a time, so it has to be removed from tenant B first. Moving mailboxes, files and apps along with the accounts is the slow part.

3. Move the subscriptions into tenant A. A subscription can be transferred to a different tenant, after which it trusts tenant A instead of tenant B (the rule above still holds: exactly one tenant). Its resources and resource IDs stay where they are, but anything tied to identity does not travel, because identities belong to a tenant:

  • All role assignments and custom roles are permanently deleted. Access has to be granted again, to identities from tenant A.
  • Managed identities must be re-enabled (system-assigned) or re-created (user-assigned), and their role assignments added back.
  • Key vaults record the tenant they trust, so their tenant ID and access policies have to be updated.
  • Some services cannot be moved this way and must be rebuilt, and some transfers need downtime.

That list is why moving a subscription between tenants is a planned project, not a click.

Once the subscriptions are in tenant A, company B usually becomes its own branch of the management group tree (the next level down), which is exactly what management groups are for:

Company B after consolidating into tenant A
Tenant A
directory with both companies' domains
Root management group
A's organization-wide rules apply to everything
Company A
A's own branch
a-prod
a-dev
Company B
B's rules, budgets and admins
b-prod
b-dev (moved in from tenant B)

Billing is a separate question again. Who pays for a subscription is decided by the billing account, not the tenant, and billing ownership can be transferred with or without moving the subscription to a new tenant. So "we're in A's tenant" and "A pays for our subscriptions" are two facts that are often, but not always, both true.

To see which tenant you are signed into and which tenant each of your subscriptions trusts:

bash
az account show --query "{tenant: tenantId, subscription: name}" --output table
az account list --query "[].{name: name, tenant: tenantId}" --output table

In the portal, Settings → Directories + subscriptions lists every tenant your account can reach, including ones where you are a guest.

Level 2: management groups

Management groups are optional folders that sit above subscriptions. They exist for organizations with many subscriptions that want to apply rules to all of them at once, rather than one subscription at a time.

Every tenant has a single root management group at the top. Below it, an organization can build a tree up to six levels deep (not counting the root), holding up to 10,000 management groups. A typical layout follows how the company is run:

A typical management group tree
Root management group
the whole organization
split by purpose
Platform
shared services
networking subscription
identity subscription
Production
customer-facing workloads
photodrop-prod
billing-prod
Non-production
dev and test
photodrop-dev
sandbox

A rule attached to "Production" (say, "every resource must be in an EU region" or "the security team can read everything") then applies automatically to every subscription below it, including ones created next year.

A learner's account, or a small company with one or two subscriptions, does not need management groups at all. It is enough to know they exist, so that when an inherited permission or policy shows up "from nowhere", you know to look higher up the tree.

Level 3: subscriptions

The subscription is the level people deal with most. It is three boundaries at once:

  1. A billing boundary. Every resource belongs to exactly one subscription, and its cost appears on that subscription's bill. Separate subscriptions mean separate invoices (or separate sections of one invoice), which is how a company tells what each product or team costs.
  2. An access boundary. Permissions granted on a subscription cover everything inside it. Someone who has access to subscription A and not subscription B cannot even see B's resources.
  3. A limits boundary. Azure caps how much of each thing a subscription can hold (how many processor cores it may run in a region, how many resource groups it can have, and so on). These quotas protect both Azure and you from runaway usage, and they apply per subscription.

Every subscription has a name you choose and an ID, a GUID, that Azure assigns:

Diagram
Subscription name: photodrop-dev
Subscription ID:   9f1c2a7e-4b3d-4e8a-a1f0-6c2d5e9b7a14

The name is for humans and can be changed. The ID never changes, and it is the one that appears in resource IDs, in the CLI, and in support tickets.

Why companies have many subscriptions

Since a subscription is the billing, access and limits boundary all at once, splitting things into separate subscriptions is the strongest separation Azure offers short of a separate tenant. Common reasons to split:

Split byWhy
Environment (dev, test, prod)a developer with full control of dev cannot touch production by accident; costs are reported separately
Product or teameach team sees and pays for only its own resources
Complianceregulated workloads get their own subscription with stricter rules
Limitsa very large workload may need its own quotas

Level 4: resource groups

A resource group is a container for resources that belong together. It is the level you will create most often by hand. Its rules are short and strict:

  • Every resource lives in exactly one resource group. There is no such thing as a resource outside one.
  • Resource groups do not nest. There are no resource groups inside resource groups.
  • A resource group belongs to exactly one subscription.
  • Deleting a resource group deletes everything inside it. Every resource, in one operation, with no further confirmation per item.
  • Most resources can be moved between resource groups, and between subscriptions, without being recreated.
  • A subscription can hold up to 980 resource groups. A resource group can hold up to 800 resources of each type, and has no overall cap on the total.

The rule for what goes in one: shared lifecycle

The question that decides grouping is: do these things get created, updated and deleted together? Things that share a lifecycle belong in the same resource group.

PhotoDrop's development environment is a natural group: its storage account, its function app, its web API and its monitoring all exist to serve one environment of one app. When that environment is no longer needed, one az group delete removes all of it, and nothing is left behind quietly charging money. That one property, cleaning up completely in one step, is the main reason resource groups exist.

Things with a different lifecycle belong elsewhere. A virtual network shared by five applications should not live in one application's resource group, because deleting that application would take everyone else's network with it.

The resource group's location

Creating a resource group asks for a location (a region, covered in Part 3), which surprises people: why does a folder need a location?

The resource group's location is where Azure stores the metadata about its resources: the record of what they are and how they are configured. It does not restrict the resources themselves, which can be in any region. A resource group in West Europe can hold a storage account in East US.

It matters in two cases. If you have rules about where data may be stored, metadata counts as data, so the group's location should be in an allowed region. And if that region has an outage, you may be unable to change the group's resources until it recovers, even if they are in a healthy region. The simple rule: put the resource group in the same region as most of its resources.

Level 5: resources

A resource is any single thing you create in Azure: a storage account, a web app, a function app, a SQL database, a key vault, a virtual network, a public IP address. It is what you actually pay for and actually use.

Resource providers and resource types

Each kind of resource is supplied by a resource provider: a service inside Azure that knows how to create and manage one family of resources. Providers have namespaces, and you will see these names everywhere:

Resource providerSupplies
Microsoft.Storagestorage accounts (blobs, queues, tables, files)
Microsoft.WebApp Service web apps and Azure Functions apps
Microsoft.SqlAzure SQL servers and databases
Microsoft.KeyVaultkey vaults
Microsoft.CacheAzure Cache for Redis
Microsoft.ServiceBusService Bus namespaces, queues and topics
Microsoft.InsightsApplication Insights and monitoring settings
Microsoft.Computevirtual machines and disks

A resource type is the provider namespace plus the type name, written with a slash: Microsoft.Storage/storageAccounts, Microsoft.Web/sites. Part 4 shows that every request to create something is really a request to one of these providers.

Resource IDs: every resource's full address

Because of the hierarchy, every resource has a unique, fully qualified address called its resource ID. It is literally the path down the tree:

Diagram
/subscriptions/9f1c2a7e-4b3d-4e8a-a1f0-6c2d5e9b7a14
  /resourceGroups/rg-photodrop-dev
  /providers/Microsoft.Storage/storageAccounts/stphotodropdev01

(It is one long string in practice; it is split over lines here for reading.) Reading it left to right walks down the hierarchy: which subscription, which resource group, which provider, which type, which name. Resource IDs show up in role assignments, in templates, in error messages and in logs, and being able to read one at a glance saves a lot of confusion.

Child resources extend the path. A database inside a SQL server has an ID ending in .../servers/sql-photodrop-dev/databases/photodrop.

Inheritance: settings flow down

The hierarchy is not just for tidiness. Most of the settings you attach to a level apply to everything below it:

SettingAttach it toInherited downward?
Role assignments (RBAC, who may do what)any levelyes
Azure Policy (rules such as "only these regions")any levelyes
Locks (prevent deletion or changes)subscription, resource group, resourceyes
Budgets (cost alerts)subscription, resource group, management groupcovers everything below
Tags (labels)subscription, resource group, resourceno

The RBAC row is the important one, and the Azure Identity series covers it in depth: grant someone the Reader role on a subscription and they can read every resource group and resource in it; grant it on one resource group and they see only that group. The level where a permission is granted is called its scope. The guiding principle is to grant at the narrowest scope that does the job: a function app that needs to read one storage account should get a role on that storage account, not on the whole subscription.

Permissions only add up as they flow down. An ordinary role assignment cannot grant Contributor on a subscription and then take it away for one resource group inside it. (Azure does have "deny assignments", but you cannot create them directly; only a few Azure features create them on your behalf.) That is another reason to choose scopes carefully.

Tags: labels for humans and invoices

A tag is a name/value label attached to a resource, resource group or subscription, such as environment: dev, owner: platform-team or costCenter: 4410. A resource can carry up to 50 tags.

Tags do nothing by themselves. Their value is in what reads them:

  • Cost reports can be grouped and filtered by tag, which is how a shared subscription answers "how much does PhotoDrop cost?".
  • Automation can act on tags, for example shutting down everything tagged autoShutdown: true at night.
  • People can see at a glance who owns a resource and whether it is safe to delete.

The trap: tags are not inherited. Tagging a resource group does not tag the resources inside it, and cost reports by tag only count resources that carry the tag themselves. Azure Policy can be set up to copy tags down or require them, but that has to be done deliberately.

Locks: protection from mistakes

A lock protects resources from accidental changes, regardless of anyone's permissions. There are two kinds:

LockEffect
CanNotDeletethe resource can be read and changed, but not deleted
ReadOnlythe resource can be read, but not changed or deleted

Locks are inherited: a CanNotDelete lock on a production resource group protects every resource in it. Even a subscription Owner must remove the lock before deleting, which turns "deleted production by running the wrong command" into "got an error and stopped to think".

Two things to know before using them. Locks apply to management operations (creating, changing, deleting the resource itself), not to the data inside it: a ReadOnly lock on a storage account does not stop an app writing blobs into it. And ReadOnly locks can break things in surprising ways, because some operations that look like reads are technically writes (listing a storage account's access keys, for instance, is a POST). CanNotDelete on production resource groups is the common, safe choice.

Naming: names are often public and permanent

Resource names deserve more thought than they get, for two reasons.

First, many names cannot be changed after creation. Renaming a storage account means creating a new one and copying the data.

Second, many names are globally unique, because they become part of a public web address. A storage account named stphotodropdev01 is reachable at stphotodropdev01.blob.core.windows.net; a web app named app-photodrop-dev gets app-photodrop-dev.azurewebsites.net. Since these are DNS names on the public internet, no two customers anywhere can have the same one. Different resource types also have different rules: a storage account name must be 3 to 24 characters, lowercase letters and digits only, with no hyphens.

Microsoft's Cloud Adoption Framework recommends a consistent pattern, roughly type abbreviation, workload, environment, region, instance:

ResourceExample name
Resource grouprg-photodrop-dev-westeurope
Storage accountstphotodropdevweu01
Function appfunc-photodrop-dev-weu
Web appapp-photodrop-api-dev-weu
Key vaultkv-photodrop-dev-weu
Application Insightsappi-photodrop-dev-weu

The exact pattern matters less than having one and sticking to it. When every name reads the same way, a resource's purpose, environment and location are visible in a list without opening anything.

Laying out a real project

Putting the levels together, a sensible layout for PhotoDrop at a small company:

PhotoDrop laid out in the hierarchy
Tenant
the company directory
Subscription: photodrop-dev
developers have Contributor
rg-photodrop-dev-westeurope
Subscription: photodrop-prod
developers have Reader; CanNotDelete lock
rg-photodrop-prod-westeurope

Each resource group then holds one environment's storage account, function app, web API, key vault and monitoring. The reasoning maps directly onto what each level is for:

  • Two subscriptions, because dev and prod need different access (developers can break dev but only read prod) and their costs should be reported separately.
  • One resource group per environment, because each environment's resources share a lifecycle.
  • A lock on prod, because deleting production by accident is the one mistake worth making impossible.
  • Consistent names and an environment tag on every resource, so cost reports and lists make sense.

A single learner's subscription simplifies this to one resource group per experiment, deleted when the experiment is done.

Seeing it from the command line

Part 5 sets up the Azure CLI properly. For reference, these are the commands that map onto this part:

bash
# Which subscriptions can I see, and which one is active?
az account list --output table
az account show
 
# Switch the active subscription
az account set --subscription "photodrop-dev"
 
# Create, list and delete resource groups
az group create --name rg-photodrop-dev-westeurope --location westeurope
az group list --output table
az group delete --name rg-photodrop-dev-westeurope --yes
 
# Everything in one resource group
az resource list --resource-group rg-photodrop-dev-westeurope --output table
 
# Protect a resource group from deletion
az lock create --name no-delete --lock-type CanNotDelete \
  --resource-group rg-photodrop-prod-westeurope

The one idea to hold onto

Every Azure resource sits at the bottom of one hierarchy: tenant (who exists), management groups (rules for many subscriptions), subscription (who pays, who has access, what the limits are), resource group (what lives and dies together) and resource (the thing itself). Permissions, policies and locks flow down the tree, tags do not, and a resource's ID is just its path down that tree.

Further reading

What comes next

The hierarchy says where a resource lives logically. Part 3 answers where it lives physically: which building, in which part of the world, and what happens when that building has a power cut. It covers regions, availability zones, region pairs and the vocabulary of reliability (durability, availability, SLAs, RTO and RPO).