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\"}}]"
I am Initializing Appclient using below code and call Create() function to create app.
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`
Also below are the API Permission from MS Graph API.