0
votes

I am using Microsoft Azure AD application token to call Power BI Generate token API. Here always i am getting 403 forbidden error. I have given all permissions to my Azure AD application but still getting error

Below is my generated token at Azure AD login

eyJ0eXAiOiJKV1QiLCJub25jZSI6IkJJRTVzcGkzaS1RbFBUQlBsVTlIQ3RkOFVHa0JJbDdURzdIcW5NTVpkSUEiLCJhbGciOiJSUzI1NiIsIng1dCI6ImtnMkxZczJUMENUaklmajRydDZKSXluZW4zOCIsImtpZCI6ImtnMkxZczJUMENUaklmajRydDZKSXluZW4zOCJ9.eyJhdWQiOiIwMDAwMDAwMy0wMDAwLTAwMDAtYzAwMC0wMDAwMDAwMDAwMDAiLCJpc3MiOiJodHRwczovL3N0cy53aW5kb3dzLm5ldC9hNmJkNTVmOC00ZDg4LTQxMDMtOTA0ZS05Mjg3ZmMxZWVjODgvIiwiaWF0IjoxNjAxNjI2MDE1LCJuYmYiOjE2MDE2MjYwMTUsImV4cCI6MTYwMTYyOTkxNSwiYWNjdCI6MCwiYWNyIjoiMSIsImFpbyI6IkFVUUF1LzhSQUFBQUdjZDhCZUZUbldHZ2xod1VQQmg4djRlamNNZDZqcEVQZ3ViajBFZ0E0dG9ya0g2YkhXa2kwRVR6d0NTYnBHd2RUL29nUkpqNUdOcmpRT0ExL3JIM3BRPT0iLCJhbXIiOlsicHdkIiwibWZhIl0sImFwcF9kaXNwbGF5bmFtZSI6Imluc2l0ZW1pbmluZ2RldiIsImFwcGlkIjoiYzM3MTVmMWEtMDhkMS00NWEyLWIxMjUtM2VjM2VhYzU2OWIxIiwiYXBwaWRhY3IiOiIwIiwiZmFtaWx5X25hbWUiOiJCaGFuZGFyaSIsImdpdmVuX25hbWUiOiJQdW5lZXQiLCJpZHR5cCI6InVzZXIiLCJpcGFkZHIiOiIyMDMuMTkyLjI1My4xOTAiLCJuYW1lIjoiUHVuZWV0IEJoYW5kYXJpIiwib2lkIjoiY2I2YWE4NjEtOWQxNS00YWRjLWE0NTgtNWExMzNkMmQ4OTc0Iiwib25wcmVt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ReSjaCz9Uguge9QsBh7Th6b8XFI4BV8fGcJgNG9EzChZVL8eFsofADLM6KJiACVJU8vOFerfOSRiUboMdAlFWQjqI-HaOf_JeS3jxt7pL81v0Mag

getting error in below API with above token, please help

https://api.powerbi.com/v1.0/myorg/GenerateToken

Is it possible to call Power BI generate token APi using Azure AD token generated by msal library

1

1 Answers

1
votes

The audience (aud) in tokens that can be used for authorization with Power BI REST API must be https://analisis.windows.net/powerbi/api:

enter image description here

while in your token it is an empty guid:

enter image description here

Obviously it isn't generated properly. You didn't showed your code, nor mentioned which language is used. See for example here how you can do it in C#.