I am trying to use power bi embeded according to the following instructions https://learn.microsoft.com/en-us/power-bi/developer/embedded/embed-multi-tenancy#create-a-profile as a multitenant. But I am stuck on the CreateProfile step, which returns the following response:
{ "error": { "code": "FeatureNotAvailableError", "pbi.error": { "code": "FeatureNotAvailableError", "parameters": {}, "details": [] } } }
But if I call GET, everything works as it should. I really followed the instructions exactly. Setting up the app, setting up tenant.
What could be causing this error? Thank you
I tried googling for a solution, calling the api differently, setting it up in Power BI, but nothing helped. I want to achieve the API call.
The error might occur if you missed enabling creating profiles option for the service principal in
Tenant Settings
of Power Bi Admin Portal.
I registered one Azure AD application and added it to group as below:
Initially, I generated access token using client credentials flow via Postman without enabling creating profiles option in Tenant settings of Power Bi:
POST https://login.microsoftonline.com/tenantId/oauth2/v2.0/token
grant_type:client_credentials
client_id: appId
client_secret: secret
scope: https://analysis.windows.net/powerbi/api/.default
Response:
When I used this token to create profile, I too got same error as below:
POST https://api.powerbi.com/v1.0/myorg/profiles
Authorization: Bearer <token>
{
"displayName": "SriProfile"
}
Response:
To resolve the error, make sure to enable creating profiles option in the Tenant settings
of Power Bi Admin Portal by adding group with service principal like below:
Now, generate the bearer token again after few minutes and use it to run the POST
request where profile will be created successfully as below:
POST https://api.powerbi.com/v1.0/myorg/profiles
Authorization: Bearer <token>
{
"displayName": "SriProfile"
}
Response: