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

Arun Kumar 0 Reputation points
2023-09-06T07:58:53.3566667+00:00

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 Free Trial subscription is available with subscription ID

Azure Role-based access control
Azure Role-based access control
An Azure service that provides fine-grained access management for Azure resources, enabling you to grant users only the rights they need to perform their jobs.
694 questions
Azure Kubernetes Service (AKS)
Azure Kubernetes Service (AKS)
An Azure service that provides serverless Kubernetes, an integrated continuous integration and continuous delivery experience, and enterprise-grade security and governance.
1,922 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,043 questions
{count} votes

5 answers

Sort by: Most helpful
  1. Staffan Hedström - HMS 40 Reputation points
    2023-11-22T09:20:17.13+00:00

    Hello!

    I just ran into this issue. This had worked before but for me the issue was the first forward slash / after --scopes. So this works:

    az role assignment create --assignee <appId> --role Contributor --scope subscriptions/<subscriptionId>
    

    But not:

    az role assignment create --assignee <appId> --role Contributor --scope /subscriptions/<subscriptionId>
    
    8 people found this answer helpful.
    0 comments No comments

  2. Sandeep G-MSFT 15,326 Reputation points Microsoft Employee
    2023-09-26T08:12:35.02+00:00

    @Arun Kumar

    Command line az ad sp create-for-rbac --role="Contributor" --scopes="/subscription/<<Subscription ID>>" is incorrect.

    You will have to mention as "Subscriptions" in the command line instead you have mentioned as Subscription.

    You can use below command line to fix the issue,

    az ad sp create-for-rbac --role 'Contributor' --scopes '/subscriptions/<<Subscription ID>>'

    Let me know if you have any further questions on this.

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    1 person found this answer helpful.

  3. Garsha Rostami 111 Reputation points
    2024-01-11T20:29:54.0333333+00:00

    I ran into a similar situation as @Staffan Hedström - HMS reporting. I think this is a bug in some terminals such as git bash. Like Staffan, I had to remove the leading "/" in "/subscriptions".

    1 person found this answer helpful.
    0 comments No comments

  4. Luis Cantero 5 Reputation points
    2024-01-15T10:08:12.12+00:00

    According to the following SO thread, using a double slash just before subscription should work, e.g.: --scopes="//subscription/<<Subscription ID>>" https://stackoverflow.com/questions/69453392/az-tag-update-error-missingsubscription-the-request-did-not-have-a-subscripti

    1 person found this answer helpful.

  5. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.

    3 deleted comments

    Comments have been turned off. Learn more