DevOpsil
Azure
85%
Needs Review

Fix Azure 'SubscriptionNotRegistered' Error

Dev PatelDev Patel3 min read

The Error: "SubscriptionNotRegistered"

You try to create an Azure resource and get:

The subscription is not registered to use namespace 'Microsoft.Compute'.
See https://aka.ms/rps-not-found for how to register subscriptions.

Or in Terraform:

Error: creating Virtual Machine: compute.VirtualMachinesClient#CreateOrUpdate:
The subscription is not registered to use namespace 'Microsoft.Compute'

The resource type doesn't matter -- this error appears for Compute, Storage, Network, ContainerService, and any other Azure resource provider.

Root Cause

Azure uses resource providers to supply functionality for each service. Before you can create resources of a specific type, the corresponding provider must be registered on your subscription. New subscriptions only have a handful of providers registered by default. If you try to use a service whose provider isn't registered, Azure blocks the request.

Common providers that trip people up:

  • Microsoft.Compute -- VMs, disks
  • Microsoft.ContainerService -- AKS
  • Microsoft.KeyVault -- Key Vault
  • Microsoft.OperationalInsights -- Log Analytics
  • Microsoft.ContainerRegistry -- ACR
  • Microsoft.DBforPostgreSQL -- PostgreSQL

Step-by-Step Fix

1. Identify Which Provider Is Missing

The error message tells you exactly which namespace is needed. Extract it from the error:

namespace 'Microsoft.Compute'

2. Check Current Registration Status

az provider show --namespace Microsoft.Compute --query "registrationState" -o tsv

If the output is NotRegistered or Unregistered, that's your problem.

3. Register the Provider

az provider register --namespace Microsoft.Compute

Registration is asynchronous. It typically takes 1-3 minutes.

4. Wait for Registration to Complete

# Poll until registered
az provider show --namespace Microsoft.Compute --query "registrationState" -o tsv

Keep checking until it returns Registered. Or use a watch loop:

watch -n 10 'az provider show --namespace Microsoft.Compute --query "registrationState" -o tsv'

5. Register Multiple Providers at Once

If you're setting up a new subscription, register all commonly needed providers:

providers=(
  Microsoft.Compute
  Microsoft.Storage
  Microsoft.Network
  Microsoft.ContainerService
  Microsoft.KeyVault
  Microsoft.ContainerRegistry
  Microsoft.OperationalInsights
  Microsoft.ManagedIdentity
  Microsoft.Authorization
  Microsoft.Monitor
  Microsoft.DBforPostgreSQL
)

for provider in "${providers[@]}"; do
  echo "Registering $provider..."
  az provider register --namespace "$provider" --wait
done

6. Verify and Retry

After registration completes, retry the original operation:

# Verify
az provider show --namespace Microsoft.Compute --query "registrationState" -o tsv
# Output: Registered

# Retry your deployment
az vm create --resource-group myRG --name myVM --image Ubuntu2204 ...

7. Handle Permission Issues

If you get an authorization error when registering:

The client does not have authorization to perform action
'Microsoft.Compute/register/action' on scope '/subscriptions/...'

You need the Contributor or Owner role on the subscription, or a custom role with */register/action permission. Ask your subscription admin to either:

# Grant you the ability to register providers
az role assignment create \
  --assignee [email protected] \
  --role "Contributor" \
  --scope "/subscriptions/YOUR_SUBSCRIPTION_ID"

Or have them register the provider for you.

Fix in Terraform

If you use Terraform, you can auto-register providers in the AzureRM provider block:

provider "azurerm" {
  features {}

  resource_provider_registrations = "extended"
}

This registers common providers automatically during terraform apply.

Prevention Tips

  • Register providers during subscription setup. Include provider registration in your subscription vending automation.
  • Use Terraform's resource_provider_registrations to handle this declaratively.
  • List all registered providers periodically: az provider list --query "[?registrationState=='Registered'].namespace" -o tsv.
  • Use Azure Policy to enforce that required providers are always registered on subscriptions.
  • Document required providers in your IaC repository README so new team members know what's needed.
Share:

Was this article helpful?

Dev Patel
Dev Patel

Cloud Cost Optimization Specialist

I find the money your cloud is wasting. FinOps practitioner, data-driven analyst, and the person your CFO wishes they'd hired sooner. Every dollar saved is a dollar earned.

Related Articles

Discussion