HomeGet-AzVM: The current subscription type is not permitted to perform operations on any provider namespace. Please use a different subscription.Microsoft AzureGet-AzVM: The current subscription type is not permitted to perform operations on any provider namespace. Please use a different subscription.

Get-AzVM: The current subscription type is not permitted to perform operations on any provider namespace. Please use a different subscription.

Get-AzVM: The current subscription type is not permitted to perform operations on any provider namespace. Please use a different subscription.

You receive the following error message once you have connected to your Azure Tenant and try to run a basic command like Get-AzVM.

A screenshot of a computer Description automatically generated with medium confidence

How to resolve this error?

To resolve this error, we simple just have to change the subscription where we have all our resources located in.

If you notice when your PSSession was setup it connected to a different Azure Subscription. So we basically just have to change the subscription

Example of the wrong subscription.

A screenshot of a computer Description automatically generated

As you can see from the above warning, because the tenant has more than one subscription it will automatically connect to the first subscription and in this case the first subscription is the wrong one so we need to change it to the right one.

How to change to the correct subscription?

We need to run the following cmd to change the subscription.

Set-AzContext -Subscription "xxxx-xxxx-xxxx-xxxx"

(the xxx-xxx represents the subscription object id)

If you do not know the subscription object id, you can run the following to get a list of your subscriptions.

Get-AzSubscription

Hope this helps the next person and saves some time.

#ThatlazyAdmin

Leave a Reply

Your email address will not be published.

© UrbanNerd Consulting 2024. All Rights Reserved. Proudly Designed by UNBRANDED_