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.
Each level answers a different question:
| Level | The question it answers | Analogy |
|---|---|---|
| Tenant | who are the people and apps in this organization? | the company's staff directory |
| Management group | which rules apply to this whole group of subscriptions? | a division of the company |
| Subscription | who pays, and what are the limits? | a department's budget and bank account |
| Resource group | which things belong to the same project and get deleted together? | a project folder |
| Resource | what is the actual thing? | a single file in the folder |
The rest of this part walks the hierarchy from top to bottom.
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:
So the tenant answers who can be given access. The levels below decide what they get access to.
"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:
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:
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:
az account show --query "{tenant: tenantId, subscription: name}" --output table
az account list --query "[].{name: name, tenant: tenantId}" --output tableIn the portal, Settings → Directories + subscriptions lists every tenant your account can reach, including ones where you are a guest.
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 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.
The subscription is the level people deal with most. It is three boundaries at once:
Every subscription has a name you choose and an ID, a GUID, that Azure assigns:
Subscription name: photodrop-dev
Subscription ID: 9f1c2a7e-4b3d-4e8a-a1f0-6c2d5e9b7a14The 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.
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 by | Why |
|---|---|
| Environment (dev, test, prod) | a developer with full control of dev cannot touch production by accident; costs are reported separately |
| Product or team | each team sees and pays for only its own resources |
| Compliance | regulated workloads get their own subscription with stricter rules |
| Limits | a very large workload may need its own quotas |
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:
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.
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.
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.
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 provider | Supplies |
|---|---|
Microsoft.Storage | storage accounts (blobs, queues, tables, files) |
Microsoft.Web | App Service web apps and Azure Functions apps |
Microsoft.Sql | Azure SQL servers and databases |
Microsoft.KeyVault | key vaults |
Microsoft.Cache | Azure Cache for Redis |
Microsoft.ServiceBus | Service Bus namespaces, queues and topics |
Microsoft.Insights | Application Insights and monitoring settings |
Microsoft.Compute | virtual 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.
Because of the hierarchy, every resource has a unique, fully qualified address called its resource ID. It is literally the path down the tree:
/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.
The hierarchy is not just for tidiness. Most of the settings you attach to a level apply to everything below it:
| Setting | Attach it to | Inherited downward? |
|---|---|---|
| Role assignments (RBAC, who may do what) | any level | yes |
| Azure Policy (rules such as "only these regions") | any level | yes |
| Locks (prevent deletion or changes) | subscription, resource group, resource | yes |
| Budgets (cost alerts) | subscription, resource group, management group | covers everything below |
| Tags (labels) | subscription, resource group, resource | no |
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.
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:
autoShutdown: true at night.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.
A lock protects resources from accidental changes, regardless of anyone's permissions. There are two kinds:
| Lock | Effect |
|---|---|
CanNotDelete | the resource can be read and changed, but not deleted |
ReadOnly | the 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.
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:
| Resource | Example name |
|---|---|
| Resource group | rg-photodrop-dev-westeurope |
| Storage account | stphotodropdevweu01 |
| Function app | func-photodrop-dev-weu |
| Web app | app-photodrop-api-dev-weu |
| Key vault | kv-photodrop-dev-weu |
| Application Insights | appi-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.
Putting the levels together, a sensible layout for PhotoDrop at a small company:
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:
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.
Part 5 sets up the Azure CLI properly. For reference, these are the commands that map onto this part:
# 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-westeuropeEvery 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.
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).