question

38918240 avatar image
0 Votes"
38918240 asked 38918240 commented

The request did not have a subscription or a valid tenant level resource provider. - facing this while creating policy. am i doing some mistake here?

surakshit@Azure:~$ az policy assignment create --name 'audit-vm-manageddisks' --display-name 'Audit VMs without managed disks Assignment' --scope 'rg-test1' --policy '06a78e20-9358-41c9-923c-fb736d382a4d'
(MissingSubscription) The request did not have a subscription or a valid tenant level resource provider.
surakshit@Azure:~$

azure-virtual-machinesazure-policy
image.png (61.5 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

prmanhas-MSFT avatar image
0 Votes"
prmanhas-MSFT answered

@38918240 Apologies for the delay in response and all the inconvenience caused because of the issue.

Assuming from your query you might be following this .I tested same in my lab by creating new policy.

First the policy definition will be as highlighted by running the command as mentioned in the article:

az policy definition list --query "[?displayName=='Audit VMs that do not use managed disks']"

127520-image.png

Now I ran the above command as mentioned by you in the query which threw the same error as you :

127631-image.png

I did some digging and as per mentioned here defined policy scope as below we need to write the scope for resource group in below format:

'/subscriptions/{SubscriptionID}/resourcegroups/{ResourceGroupName}'

Again I ran the same command as mentioned by you and changed the scope as above where final command will look something like below and it worked for me :

az policy assignment create --name 'audit-vm-manageddisks' --display-name 'Audit VMs without managed disks Assignment' --scope '/subscriptions/<Subscriptionid>/resourcegroups/prmanhas-Compute' --policy '06a78e20-9358-41c9-923c-fb736d382a4d'

127596-image.png

Same should work for you too :)

Hope it helps!!!

Please "Accept as Answer" if it helped so it can help others in community looking for help on similar topics.














image.png (120.1 KiB)
image.png (70.4 KiB)
image.png (246.2 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.