Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to create Azure AD app using service principal credentials #33

Open
akhilesh2410 opened this issue Dec 23, 2021 · 0 comments
Open

Comments

@akhilesh2410
Copy link

I have created an Azure AD app using " az ad sp create-for-rbac --sdk-auth --role Owner" command.
Also i have given required api permission as mentioned below:
api-permission

I am getting 403 error with below code:
error i am getting
error": "graphrbac.ApplicationsClient#Create: Failure responding to request: StatusCode=403 -- Original Error: autorest/azure: Service returned an error. Status=403 Code=\"Unknown\" Message=\"Unknown service error\" Details=[{\"odata.error\":{\"code\":\"Authorization_RequestDenied\",\"date\":\"2021-12-23T11:41:23\",\"message\":{\"lang\":\"en\",\"value\":\"Insufficient privileges to complete the operation.\"},\"requestId\":\"f192ac37-8b05-4a81-a582-13f0f5ca3594\"}}]"

Code i am using to initialize app client is :

appClient := graphrbac.NewApplicationsClient(tenantID) credConfig := auth.NewClientCredentialsConfig(clientID, clientSecret, tenantID) //credConfig.Resource = azure.PublicCloud.ResourceIdentifiers.Graph credConfig.Resource = "https://graph.microsoft.com" authorizer, err := credConfig.Authorizer() if err != nil { return appClient, err } appClient.Authorizer = authorizer

I am not sure how i can create an Azure AD app client for microsoft Graph API SDK, since there is no method i have found for the same.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant