Skip to content
Tutorials Center
My learning

Topics

Lesson 5 of 57 ยท Cloud and Azure Basics

Resource Groups and Azure Resource Manager

Learn how Azure organizes resources: resource groups, resource IDs, tags, naming conventions, locks and Azure Resource Manager as the single control plane.

Everything you create in Azure is a resource: a virtual machine, a storage account, a database, a virtual network. Resources are kept in resource groups, and every request to create, change or delete them goes through Azure Resource Manager (ARM). Understanding these three ideas explains most of what you see in the portal, in command output and in templates.

This lesson covers resources, resource groups, the structure of a resource ID, tags, naming conventions, locks and the role of ARM. The real commands are shown read-only. The runnable examples are JavaScript stand-ins that parse resource IDs and group resources by tag.

Resources and resource groups

A resource group is a logical container for resources that belong together and share a lifecycle: you deploy them together, manage them together and delete them together. A typical split is one group per application and environment, such as rg-shop-prod and rg-shop-dev.

Rules worth memorizing:

  • Every resource lives in exactly one resource group, and you can move many (not all) resources between groups.
  • A resource group has a location, but this only says where the group's metadata is stored. Resources inside can be in other regions.
  • Resource groups cannot be nested, and they cannot contain other groups. Use management groups and subscriptions for higher-level organization (see Accounts, Tenants and Subscriptions).
  • Deleting a resource group deletes everything in it. This is both a great clean-up tool and a risk.

The practical test for "which group does this belong in?" is: would I delete these together? A web app and its database that die together belong together. A shared network used by ten apps probably deserves its own group.

Terminal
az group create --name rg-shop-dev --location westeurope --tags env=dev owner=team-shop
az group list --output table
az resource list --resource-group rg-shop-dev --output table
az group delete --name rg-shop-dev --yes

The anatomy of a resource ID

Every resource has a unique resource ID, a path that reflects the scope hierarchy. For example, a storage account:

Text
/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-shop-dev/providers/Microsoft.Storage/storageAccounts/stshopdev001

Reading it from left to right: the subscription ID, the resource group, then providers/ followed by the resource provider namespace (Microsoft.Storage), the resource type (storageAccounts) and the resource name. Child resources extend the path, for example a blob service or a subnet inside a virtual network:

Text
.../providers/Microsoft.Network/virtualNetworks/vnet-shop/subnets/snet-web

Resource IDs appear everywhere: in az output, in role assignments, in Bicep references and in logs. Being able to read one saves a lot of time. Each service lives in a resource provider (Microsoft.Compute, Microsoft.Storage, Microsoft.Network, Microsoft.Sql), and a subscription must have the provider registered before you can create its resources. Registration is automatic for most providers when you use the portal, but sometimes you must run az provider register --namespace Microsoft.App yourself.

Azure Resource Manager

Azure Resource Manager is the deployment and management service of Azure. It is the single control plane: the portal, CLI, PowerShell, SDKs, Bicep and Terraform all send their requests to ARM's REST endpoint. ARM does three jobs for each request:

  1. Authenticates the caller through Microsoft Entra ID.
  2. Authorizes it, checking role assignments, deny assignments, locks and policies at the target scope.
  3. Routes it to the correct resource provider, which does the actual work.
sequenceDiagram
    participant U as You (CLI or portal)
    participant A as Azure Resource Manager
    participant E as Entra ID
    participant P as Resource provider
    U->>A: PUT resource (with token)
    A->>E: Validate token
    A->>A: Check RBAC, policy, locks
    A->>P: Create or update
    P-->>A: Result
    A-->>U: Response

ARM authenticates, authorizes and then hands the work to the resource provider.

Because everything passes through one place, RBAC, policy, locks, tags, activity logs and cost data all work the same way for every service. This is the control plane, the management side. The data plane is separate: reading a blob or querying a database talks to the service directly with its own authorization (covered in Storage Security and SAS Tokens).

ARM is also what makes declarative deployment possible. You describe the resources you want in a template, and ARM figures out dependencies and creates them, in parallel where it can (see Bicep and ARM Templates).

Tags

Tags are name-value pairs attached to resources and resource groups, such as env=prod, owner=alice or costCenter=1234. They do not change how a resource works. They exist so that you can find, organize and bill resources:

  • Filter the portal and CLI lists by tag.
  • Break the cost report down by tag for chargeback.
  • Drive automation, for example "shut down VMs tagged autoshutdown=true at night".

Things to know: a resource can have up to 50 tag name-value pairs; tag names are not case-sensitive but values are; and tags are not inherited from the resource group by default. A group tagged env=prod does not make its resources tagged env=prod, unless you add a policy that copies it (see Azure Policy, Locks and Tags). Do not put secrets in tags: tag names and values are visible to anyone who can read the resource and appear in billing data.

Naming conventions

Azure does not choose names for you, and a good convention makes the environment readable. A common pattern is <type>-<workload>-<environment>-<region>-<instance>, using the Cloud Adoption Framework's short abbreviations:

Resource Prefix Example
Resource group rg rg-shop-prod-weu
Virtual network vnet vnet-shop-prod-weu
Virtual machine vm vm-web-prod-001
Storage account st stshopprod001
Key vault kv kv-shop-prod-weu

Naming rules differ by type. Storage account names must be globally unique, 3 to 24 characters, lowercase letters and digits only, which is why they have no hyphens. Many resources cannot be renamed after creation, so decide early.

Locks

A resource lock prevents accidental changes regardless of permissions. There are two kinds:

  • CanNotDelete: authorized users can read and modify the resource, but not delete it.
  • ReadOnly: authorized users can only read it; changes are blocked as well. This can have surprising side effects, for example on a storage account it can block listing keys, because that is a POST operation.

Locks are inherited by child resources and apply to everyone, including owners, until the lock is removed. They protect against the "oops" case, not against an administrator who is willing to remove the lock first. They are discussed further in Azure Policy, Locks and Tags.

Terminal
az lock create --name keep-it --lock-type CanNotDelete --resource-group rg-shop-prod
az lock list --resource-group rg-shop-prod

Parsing resource IDs: a stand-in

The first stand-in takes resource IDs and splits them into the parts you just learned about. Real tools do the same parsing internally. The IDs are made-up examples.

JS Read a resource ID

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The second ID shows a child resource: a subnet is part of a virtual network, so the path alternates type and name twice.

Grouping by tag: a stand-in

The second stand-in does what a cost report does, grouping by tag and flagging resources that miss a required tag. The costs are invented.

JS Group resources by tag

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The untagged line is the one finance asks about. This is why tagging policies exist.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

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

    Deleting a resource group deletes every resource in it, which makes groups good lifecycle boundaries and deletion a risk.
  2. 2. In /subscriptions/S/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/st1, what is Microsoft.Storage?

    After providers/ comes the resource provider namespace, then the resource type and name.
  3. 3. Are tags on a resource group automatically applied to its resources?

    Tags are not inherited by default. Azure Policy can add or copy tags to resources.
  4. 4. Which lock lets users read and change a resource but not delete it?

    CanNotDelete blocks deletion only. ReadOnly also blocks modification.

Summary

  • Resources live in exactly one resource group; groups are lifecycle containers and cannot be nested.
  • A resource ID encodes subscription, resource group, provider, type and name.
  • Azure Resource Manager is the single control plane that authenticates, authorizes and routes every management request.
  • Tags help find, organize and bill, but are not inherited and must not hold secrets.
  • Naming conventions and locks reduce confusion and accidents.

Next: Microsoft Entra ID.