Skip to content
$ lynuxpro
← Microsoft Azure

LESSON 2 OF 23 · BEGINNER · 12 MIN

Subscriptions, management groups and resource groups

Free previewLesson 2 of the 2 free lessons in this Pro course.Unlock all 23

HOW IT WORKSThe Azure tree

TenantEntra directory
1/5

Everything starts in a tenant: your company's directory of users.

In simple words

  • Subscription: a billing and access boundary that holds your Azure resources.
  • Management group: a folder of subscriptions, used to apply rules and access to many at once.
  • Resource group: a folder for related resources (an app's VM, database and network) that you manage and delete together.
  • Resource: one thing you create, such as a VM, a storage account or a database.

Big picture

Before you create anything in Azure, you need to know where it lives. Azure organizes everything in a tree. Think of a company: the whole company at the top, departments below, and project folders inside each department. Rules and budgets set high up flow down to everything below.

The four levels

Tenant (your company's Microsoft Entra directory)└── Management group: Production    └── Subscription: shop-prod        └── Resource group: rg-shop-web-prod            └── Resources: VM, database, storage account
OUTPUTterminalutf-8 · 5L
LevelWhat it isWhy it matters
TenantYour organization's identity directory (lesson 03)One set of users for everything
Management groupA folder that holds subscriptionsApply rules and access to many subscriptions at once
SubscriptionA billing and limits boundaryEach gets its own bill and its own quotas
Resource groupA folder for resources that live and die togetherDelete the group, and everything in it goes
ResourceOne thing, such as a VMThe thing you actually pay for

Access (RBAC) and policies set at a higher level are inherited by everything below.

Resource groups in practice

A resource group holds things with the same life. If you would delete them together, put them together.

az group create --name rg-shop-web-dev --location westeurope --tags env=dev owner=anna cost-center=1042
SHELLbashutf-8 · 1L
{  "id": "/subscriptions/1111-aaaa/resourceGroups/rg-shop-web-dev",  "location": "westeurope",  "name": "rg-shop-web-dev",  "properties": { "provisioningState": "Succeeded" },  "tags": { "cost-center": "1042", "env": "dev", "owner": "anna" }}
OUTPUTterminalutf-8 · 7L
az group list --query "[].{Name:name, Region:location}" -o tableaz group delete --name rg-shop-web-dev --yes --no-wait
SHELLbashutf-8 · 2L

Facts to remember:

  • A resource belongs to exactly one resource group.
  • The group has a region only for its own metadata. Resources inside can be in other regions.
  • Deleting a group deletes everything inside it. This is useful for test environments and dangerous in production.

Working with subscriptions

az account list --query "[].{Name:name, Id:id, Default:isDefault}" -o tableaz account set --subscription "shop-prod"az account show --query "{sub:name, tenant:tenantId}"
SHELLbashutf-8 · 3L
Name        Id          Default----------  ----------  ---------shop-dev    1111-aaaa   Trueshop-prod   2222-bbbb   False
OUTPUTterminalutf-8 · 4L

Many teams use one subscription per environment (dev, test, prod). That keeps costs separate and limits damage from mistakes.

Naming and tags

Use a clear naming pattern so anyone can read it: <type>-<app>-<role>-<env>, for example rg-shop-web-prod, vm-shop-api-01, st for storage. Microsoft's Cloud Adoption Framework lists suggested short names.

Tags are key and value labels (env=prod, owner=anna). They are how you find owners and split costs. Tags are not inherited by default. Azure Policy (lesson 19) can force or copy them.

Locks

A lock stops accidental changes.

az lock create --name keep --lock-type CanNotDelete --resource-group rg-shop-web-prod
SHELLbashutf-8 · 1L

CanNotDelete allows changes but blocks deletion. ReadOnly blocks all changes, which can surprise you (for example it can block some start and restart actions). Even owners must remove a lock before deleting.

Common mistakes

  • Putting unrelated things in one huge resource group, so you can never clean up.
  • Mixing dev and prod in one subscription with the same access.
  • Not tagging, then having no idea who owns a costly resource.
  • Using ReadOnly locks without testing what they block.

Summary

  • Azure is a tree: tenant, management groups, subscriptions, resource groups, resources.
  • Rules and access flow downward from higher levels.
  • A resource group is a folder of things that share a life.
  • Use one subscription per environment, a naming pattern, tags and locks.

CHECK YOUR UNDERSTANDING

3 quick questions

  1. 1. What happens when you delete a resource group?

  2. 2. Where would you apply one policy to many subscriptions at once?

  3. 3. What does a CanNotDelete lock do?

You've finished the free preview of Microsoft Azure

Upgrade to Pro to unlock the remaining 21 lessons, every practice lab and a certificate when you finish.

See plans