Forum Discussion

Healthec's avatar
Healthec
Frequent Visitor
5 years ago

Operation returned an invalid status code Forbidden Microsoft.PowerBI.Api.V2.Reports

Dear Support Team,

 

I am running Power bi Embed report for user inside external asp.net application. It was working fine, I did not face any issue there.

But from last week I am finding like none of the Power bi reports are loading inside asp.net application.

 

When i debug the application then found below error:

 

Operation returned an invalid status code Forbidden  Microsoft.PowerBI.Api.V2.Reports.<GenerateTokenInGroupWithHttpMessagesAsync>

 

I have visited the app registration inside Azure and in the API Permission section i found below information:

 

"This application is using Azure AD Graph API, which is on a deprecation path. Starting June 30th, 2020 we will no longer add any new features to Azure AD Graph API. We strongly recommend that you upgrade your application to use Microsoft Graph API instead of Azure AD Graph API to access Azure Active Directory resources."

 

In this case i added Microsoft Graph API and provided permission for it like below:

 

 

As you can see in above image, We have provided all the required permission.

For accessing the Power bi API we use ClientID, Power bi Pro Userid and Password to authenticate.

But getting above exception in below piece of code only.

 

var tokenResponse = client.Reports.GenerateTokenInGroup(GroupId, report.Id, generateTokenRequestParameters);

 

Kindly check and suggest, Since this issue is occurred in Production environment, Please treat it as urgent.

 

Thanks,

Vikash

5 Replies