Error when generating credentials for GitHub Actions in CLI

Andrew-3197 0 Reputation points
2024-08-10T15:13:52.12+00:00

I am trying to generate credentials to use for GitHub actions but I keep getting the error message "Subscription 'resourceGroups' not found. Check the spelling and casing and try again." I copied and pasted the command from [Use GitHub Actions workflow to deploy your static website in Azure Storage] and inserted my own id and path. I saw from another post to remove the leading "/" before subscriptions to get it to work.

I just tried using the exact command with the leading "/" and I get the error "(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."

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.
814 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
939 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. akinbade abiola 17,290 Reputation points
    2024-08-11T02:50:02.54+00:00

    The correct structure for the command should be:

    az ad sp create-for-rbac -n MyApp --role Contributor --scopes /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup2
    

    See: https://learn.microsoft.com/en-us/cli/azure/ad/sp?view=azure-cli-latest#az-ad-sp-create-for-rbac

    You can mark it 'Accept Answer' and 'Upvote' if this helped you

    Regards,

    Abiola

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.