skip to Main Content

When i trying to run command

az ad sp create-for-rbac --role="Contributor" --scopes="/subscription/<<Subscription ID>>"

I am getting error as

(MissingSubscription) The request did not have a subscription or a valid tenant level resource provider.

Code: MissingSubscription

Message: The request did not have a subscription or a valid tenant-level resource provider.

I just created a new azure account where a Free Trial subscription is available with a subscription ID

2

Answers


  1. Chosen as BEST ANSWER

    The command was not working either way, so had to register the app with contributor role manually in order to get app id and secret key.


  2. I tried in my environment and got the below results:

    Initially, I got the same error when I tried with scope "/subscriptions/{SubscriptionID}" .

    Error:
    enter image description here

    For assigning a contributor role to Kubernetes service you need to copy the resourceId from your Kubernetes service.

    Portal->Kubernetes service->properties->Copy respurceID

    Portal:

    enter image description here
    Command:

    az ad sp create-for-rbac --role="Contributor" --scopes= "/subscriptions/< subscription id >/resourcegroups/< Resource group >/providers/Microsoft.ContainerService/managedClusters/SampleAKS"
    

    Output:
    enter image description here

    Reference:

    az ad sp | Microsoft Learn

    Update:

    Try passing the scopes without double quotes.

    Command:

    az ad sp create-for-rbac --role="Contributor" --scopes=/subscriptions/xxxxxxx
    

    Output:

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search