MOFAKH.COM
← Back to profile
Azure Fundamentals

Azure Resource Manager: the one front door behind every click

Nov 20, 202613 min readWritten

The portal, the CLI, PowerShell, every SDK, Bicep and Terraform are all just different ways of sending the same HTTPS requests to one service: Azure Resource Manager. This part follows a single request from your machine to a running resource, separates managing a resource (the control plane) from using it (the data plane), and shows why an idempotent PUT of desired state is the idea Infrastructure as Code is built on.

This is the fourth part of the Azure series. Parts 2 and 3 described where resources live. This part is about how they come to exist, change and disappear, and it opens one of the biggest black boxes in the path: what actually happens when you click Create in the portal.

The answer is the same no matter which tool you use, and seeing that is the main point of the part. There is exactly one front door to manage anything in Azure, and every tool is a different way of knocking on it.

Many tools, one API

There are a lot of ways to create a storage account:

  • click through the Azure portal in a browser;
  • run az storage account create in the Azure CLI;
  • run New-AzStorageAccount in Azure PowerShell;
  • call the storage management client from an SDK in C#, Python, JavaScript, Java or Go;
  • write a Bicep file or an ARM template and deploy it;
  • use Terraform, Pulumi or another third-party tool.

They look completely different, but they all do the same thing underneath: they turn your intent into an HTTPS request to a single service called Azure Resource Manager (ARM), at the address management.azure.com.

Every management tool talks to the same front door
Your tools
all just HTTP clients
portal
CLI
PowerShell
SDKs
Bicep
Terraform
HTTPS + token
Azure Resource Manager
management.azure.com
authenticate
authorize
check policy and locks
route
forwards to
Resource providers
the services that do the work
Microsoft.Storage
Microsoft.Web
Microsoft.Sql

This design has consequences that make Azure much easier to reason about:

  • Every tool can do the same things. There is no "portal-only" feature in principle, because the portal is just one more client of ARM. (In practice a brand-new feature sometimes reaches the portal or CLI a little later than the API.)
  • Every tool gets the same security checks. Permissions, policies and locks are enforced by ARM, so there is no way around them by switching tools.
  • Every change is logged in one place. ARM records every write it handles, whichever tool sent it.
  • Any tool can manage what another tool created. A storage account created in the portal can be changed from the CLI and deleted by a template.

Following one request

Here is what happens, step by step, when you run:

bash
az storage account create --name stphotodropdev01 \
  --resource-group rg-photodrop-dev --location westeurope --sku Standard_LRS

1. The tool builds an HTTP request. The CLI turns the command into a PUT request whose URL is the resource ID from Part 2, plus an API version, and whose body is the resource's desired configuration as JSON:

http
PUT https://management.azure.com/subscriptions/9f1c2a7e-4b3d-4e8a-a1f0-6c2d5e9b7a14/resourceGroups/rg-photodrop-dev/providers/Microsoft.Storage/storageAccounts/stphotodropdev01?api-version=2023-05-01
Authorization: Bearer eyJ0eXAiOiJKV1Qi...
Content-Type: application/json
 
{
  "location": "westeurope",
  "sku": { "name": "Standard_LRS" },
  "kind": "StorageV2"
}

2. The tool attaches a token. The Authorization header carries an access token from Entra ID, obtained when you ran az login. The Azure Identity series covers how that token is issued; here it is enough that it proves who is making the request.

3. ARM authenticates the request. It validates the token: signed by Entra, not expired, issued for Azure Resource Manager as its audience. If not, the request stops with 401 Unauthorized.

4. ARM authorizes the request. It checks Azure RBAC: does this identity hold a role, at this scope or any scope above it, that allows the action Microsoft.Storage/storageAccounts/write? If not, 403 Forbidden.

5. ARM checks policy. Azure Policy rules attached at any level above are evaluated against the request body. A rule such as "storage accounts must not allow public access" or "only EU regions" can deny the request here, before anything is created.

6. ARM checks locks. If the resource or any scope above it has a lock that forbids this operation, the request is rejected.

7. ARM forwards the request to the resource provider. The URL path names the provider (providers/Microsoft.Storage/storageAccounts), so ARM routes the request to the Storage resource provider, which actually knows how to create a storage account.

8. The resource provider does the work. It validates the configuration, reserves the name, allocates capacity in the region, and starts creating the account.

9. The response comes back. For quick operations the provider answers immediately with the resource's state. For slow ones, which is most creations, it answers with 202 Accepted or 201 Created and a URL where the caller can check on progress; this is called a long-running operation. The CLI quietly polls that URL until the operation finishes, which is why az commands sometimes sit at "Running..." for a minute.

10. ARM logs the operation in the subscription's activity log: who did what, to which resource, when, and whether it succeeded.

Every management action in Azure is this sequence. A portal click, a template deployment and a Terraform run all go through the same authenticate, authorize, policy, lock, route steps. When a deployment fails with a 401, 403, a policy violation or a lock error, you now know which step said no.

API versions

Every ARM request carries an api-version query parameter, a date such as 2023-05-01. Each resource provider publishes its API in dated versions, and a request is handled according to the version it asks for.

This lets Azure add new properties and change behaviour without breaking old scripts: a template written against an old storage API version keeps working years later, because ARM still understands that version. When you see @2023-05-01 in a Bicep file or api-version= in a URL, that is all it means: "interpret this request the way version 2023-05-01 of this API defines it".

Resource providers and registration

Part 2 introduced resource providers (Microsoft.Storage, Microsoft.Web and so on) as the services that supply each type of resource. Two more facts about them become relevant now.

First, a subscription must be registered with a resource provider before it can create that provider's resources. Common providers are registered automatically, and many tools register a provider for you the first time you use it. But a "subscription is not registered to use namespace" error is a classic first-day surprise, and the fix is one command:

bash
az provider register --namespace Microsoft.Web
az provider show --namespace Microsoft.Web --query registrationState

Second, providers can be explored. Each one lists its resource types, the regions they are available in and their API versions. This is the source of truth for questions such as "can I create this type of resource in this region?":

bash
# Which resource types does the Storage provider offer, and where?
az provider show --namespace Microsoft.Storage \
  --query "resourceTypes[?resourceType=='storageAccounts'].locations" --output json

Control plane and data plane

Here is the distinction that resolves more Azure confusion than any other in this part. Azure handles two completely different kinds of request:

Control planeData plane
What it doesmanages resources: create, configure, deleteuses resources: read and write what is inside them
Examplecreate a storage account; change its redundancyupload a blob; read a queue message; run a SQL query
Addressmanagement.azure.com (Resource Manager)the resource's own endpoint, such as stphotodropdev01.blob.core.windows.net
Who handles itARM, then the resource providerthe service itself, directly
Permissionsmanagement roles (Owner, Contributor, Reader)data roles (Storage Blob Data Reader, and so on) or service-specific keys
Logged inthe activity logthe service's own logs, if enabled
Affected by locksyesno
Two different doors into the same storage account
Control plane
management.azure.com
create account
set redundancy
delete account
both reach
Storage account
stphotodropdev01
both reach
Data plane
stphotodropdev01.blob.core.windows.net
upload blob
list blobs
download blob

Your application, at run time, almost never touches the control plane. When PhotoDrop uploads a photo, it talks directly to the storage account's blob endpoint, not to Resource Manager. Resource Manager is for setting things up; the data plane is for running.

The distinction explains several things that otherwise look like bugs:

  • "I'm an Owner but I can't read the blobs." Owner and Contributor are control-plane roles: they let you manage the storage account, not read its data. Reading data with your Entra identity needs a data-plane role such as Storage Blob Data Reader. (An Owner can still get to the data indirectly, because listing the account's access keys is a control-plane action and the keys grant full data access. That is one of several reasons the Storage topic recommends turning key access off.)
  • "The lock didn't stop the deletion." Locks apply to the control plane. A CanNotDelete lock stops someone deleting the storage account; it does not stop an app deleting blobs inside it.
  • "The activity log doesn't show the upload." The activity log records control-plane operations. Data-plane activity, such as individual blob reads, is recorded only in the service's own diagnostic logs, if you turn them on.

Idempotent PUT: describing the end state

Look again at the request from earlier. It is a PUT with the complete desired configuration of the resource: "there should be a storage account at this address, in West Europe, with LRS redundancy." It does not say "create" or "change"; it says "make it so".

That makes the request idempotent: sending it once or ten times leaves the same result.

  • If the account does not exist, ARM creates it.
  • If it exists with exactly that configuration, nothing changes.
  • If it exists with a different configuration (say GRS instead of LRS), ARM updates it to match, where the change is allowed.

This is a small HTTP detail with a large consequence. Because every resource can be described as a desired end state, and sending that description is safe to repeat, a whole environment can be written down as a file and applied again and again. That is the foundation of Infrastructure as Code.

Imperative versus declarative

There are two styles of telling Azure what you want:

ImperativeDeclarative
You writethe steps: create this, then that, then change thisthe end state: these resources should exist, configured like this
Typical toolsportal clicks, CLI scriptsBicep, ARM templates, Terraform
Running it twicemay fail ("already exists") or duplicate work, unless the script checks firstsafe: the second run finds nothing to change
Seeing what will changehardbuilt in: tools can show a preview before applying
Reproducing an environmentre-run a script and hopeapply the same file to a new resource group

Imperative commands are perfect for learning and for one-off tasks, and this path uses the CLI heavily for exactly that reason. For anything that must be reproduced (a staging environment that matches production, a dev environment for each developer), the declarative style wins.

A first look at Bicep

Bicep is Microsoft's language for declaring Azure resources. Its files compile to ARM templates (the older JSON format) and are sent to ARM as a deployment. The PhotoDrop storage account in Bicep:

bicep
param location string = resourceGroup().location
 
resource storage 'Microsoft.Storage/storageAccounts@2023-05-01' = {
  name: 'stphotodropdev01'
  location: location
  sku: {
    name: 'Standard_LRS'
  }
  kind: 'StorageV2'
  properties: {
    minimumTlsVersion: 'TLS1_2'
    allowBlobPublicAccess: false
  }
}

Every piece maps onto something from this part or Part 2: the resource type (Microsoft.Storage/storageAccounts), the API version (@2023-05-01), and the same properties the CLI put in its JSON body. Deploying it:

bash
# Preview what would change, without changing anything
az deployment group what-if --resource-group rg-photodrop-dev --template-file main.bicep
 
# Apply it (safe to run again: the second run changes nothing)
az deployment group create --resource-group rg-photodrop-dev --template-file main.bicep

Each template deployment is recorded in the resource group's deployment history, so you can see what was deployed, when, and with which parameters. Infrastructure as Code gets its own track later in this notebook; for now the point is only that it is possible because ARM accepts idempotent, declarative PUTs.

Talking to ARM directly

Since every tool is just an HTTP client, you can skip the tools and call ARM yourself. The CLI's az rest command sends a raw request with your login token already attached, which makes the "it's all just HTTP" idea concrete:

bash
# List resource groups by calling Resource Manager directly.
# az rest fills in {subscriptionId} from your active subscription.
az rest --method get \
  --url "https://management.azure.com/subscriptions/{subscriptionId}/resourcegroups?api-version=2021-04-01"

The JSON that comes back is exactly what az group list formats into a table. Seeing the raw response once is worth it; after that, the higher-level commands are simply more convenient.

ARM also protects itself. Each subscription and each identity can only send so many requests in a period, and a script that hammers the API gets 429 Too Many Requests responses with a header saying how long to wait. Well-behaved tools, including the CLI and SDKs, back off and retry automatically.

The activity log

Every control-plane write that ARM handles lands in the subscription's activity log, kept for 90 days by default. It answers the questions people ask after something has gone wrong: who deleted that resource group, who changed that setting, did that deployment really run?

bash
# Recent management operations in a resource group
az monitor activity-log list --resource-group rg-photodrop-dev \
  --offset 7d --output table

Because every tool goes through ARM, the activity log is complete: there is no way to make a management change that does not show up here. (Data-plane operations, as covered above, are not in it.)

The one idea to hold onto

Every way of managing Azure, from the portal to Terraform, is an HTTP client for one service, Azure Resource Manager. ARM authenticates the caller, checks RBAC, policy and locks, then routes the request to the resource provider that does the work, and logs it. That is the control plane: managing resources. Using them (uploading a blob, querying a database) is the data plane, which goes straight to the resource's own endpoint with its own permissions. And because a resource is created by an idempotent PUT of its desired state, whole environments can be described in files and applied repeatedly: Infrastructure as Code.

Further reading

What comes next

Four parts of concepts are enough. Part 5 sets up a real working environment: a free Azure account with a budget so it can never surprise you, the Azure CLI and az login, and the local emulators (Azurite, Functions Core Tools, Docker) that let most of this path run on a laptop without touching the cloud at all. It ends with a smoke test of every tool.