The subscription is not registered to use namespace Microsoft.VirtualMachineImages

I am finally getting around to some hands-on with Azure Image Builder.  More to come on that shortly.  For now, I want to document my first issue for anyone who may experience the same problem.  When creating the image builder template with the New-AzImageBuilderTemplate command, I got the following error message:

Az.ImageBuilder.internal\New-AzImageBuilderTemplate @PSBo …
The subscription is not registered to use namespace ‘Microsoft.VirtualMachineImages’. See for how to register subscriptions.

The subscription is not registered to use namespace 'Microsoft.VirtualMachineImages'
Subscription not registered

The error indicates that a required resource provider, Microsfot.VirtualMachineImages in this instance, is not registered.  The provider can be registered with PowerShell or through the portal.  Below are the steps for each.

From the portal, go to your Subscription, then find Resource Providers under Settings.

Resource Provider in the Azure Portal
Resource Provider in the Azure Portal

Search for the resource provider Microsoft.VirtualMachineImages.  Notice the status is Not Registered.  Click the Register button in the portal to register the resource provider.

Resource Provider Not Registered
Resource Provider Not Registered

To register a provider from PowerShell, log into Azure with rights to register a resource provider, such as subscription admin.  Next, use the Register-AzResourceProvider command below to register the provider.

Register-AzResourceProvider -ProviderNamespace Microsoft.VirtualMachineImages

The provider will go to a state of registering.  It could take a few minutes for the service to register.

Resource Provider Registering
Resource Provider Registering

From PowerShell, use the command Get-AzResourceProvider to verify the status.

Get-AzResourceProvider -ProviderNamespace Microsoft.VirtualMachineImages

Once finished, the resource provider changes to the Registered status.

Resource Provider Registered
Resource Provider Registered

The New-AzImageBuilderTemplate should run now without an error.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.