Troubleshooting GitHub Secrets: "Invalid Subscription or Tenant Level Error"

43 views Asked by At

I am trying to create a GitHub workflow and encountering an error when attempting to store secrets using the following command. It indicates either an invalid subscription or an invalid tenant level. Can someone please help me with this?

az ad sp create-for-rbac --name "myApp" --role contributor \
         --scopes /subscriptions/{subscription-      id}/resourceGroups/cloudresume/providers/Microsoft.Web/sites/GetResumeCounter2410 \
         --sdk-auth

I was expecting to get:

{
    "clientId": "<GUID>",
    "clientSecret": "<GUID>",
    "subscriptionId": "<GUID>",
    "tenantId": "<GUID>",
    (...)
}

However, I get an error like this:

(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.

1

There are 1 answers

1
Arko On

The error message "The request did not have a subscription or a valid tenant level resource provider" indicates that the subscription ID specified is invalid or the tenant ID is incorrect.

You can use the command az account list to list the available subscriptions and ensure that you are using the correct subscription ID.

enter image description here

If you are using variables, you can use the Bash echo command to see the value being passed to the reference command. You can also use az account set to change your subscription.

Correct command-

az ad sp create-for-rbac --name "YourApp" --role contributor \
--scopes /subscriptions/<subscriptionId>/resourceGroups/<YourRGName>/providers/Microsoft.Web/sites/{YourWebAppName} \
--sdk-auth

enter image description here

References: