Forum Discussion
Publish report issue with power automate
Hello,
I am having issue to publish a report throw a power automate.
The purpose of this flow is for a public user to report (via the main service account) on a Fabric workspace via API.
The Fabric space has a Fabric licence and the main service account is a contributor.
The main service account has the correct rights on the app registration (Power BI Service → Dataset.ReadWrite.All and Report.ReadWrite.All).
The flow is configured in four parts.
Part 1
Manually trigger a flow to drop the pbix file.
Part 2
HTTP - POST - Retrieve the authorisation token
with Azure authentication, app registration.
+ Set access token.
Part 3
HTTP - POST - Publish the report
‘uri’: ‘https://api.powerbi.com/v1.0/myorg/groups/{MyWorkspaceID}/imports?datasetDisplayName=@{triggerBody()?[“file”]?[“name”]}&nameConflict=CreateOrOverwrite’
‘headers’: {
‘Content-Type’: ‘application/octet-stream’,
‘Authorisation’: ‘@{variables(“access_token”)}’
}
‘body’: ‘@{base64ToBinary(triggerBody()?[“file”]?[“contentBytes”])} ’
Part 4
Creating a log entry in a SharePoint list
An error occurs in part 3
{‘code’:‘BadRequestException’,“message”:‘The request was denied, it contains illegal input: “”’}
I reproduce the flow on C# and it works.
Why cause this issue ? and how to push the report without issue ?
Regards,
Théo
Here's the solution based on this article Use Power Automate HTTP Connector to Publish .pbix File Using the Power BI API – Joel Leichty
The HTTP step need the authentification by Active Directory OAuth.{
"$content-type": "multipart/form-data",
"$multipart": [
{
"headers": {
"Content-Disposition": "form-data; name=\"Rapport\"; filename=\"Rapport.pbix\""
},
"body": @{base64ToBinary(triggerBody()?['file']?['contentBytes'])}
}
]
}
4 Replies
- lbendlinSuper User
You will need to create and use a custom connector for the Power BI REST API calls. It is not possible to authenticate the way you are attempting to. The custom connector will handle the authentication for you.
- lbendlinSuper User
You will need to create and use a custom connector for the Power BI REST API calls.
Custom connectors overview | Microsoft Learn
- Theo_MSAdvocate I
Here's the solution based on this article Use Power Automate HTTP Connector to Publish .pbix File Using the Power BI API – Joel Leichty
The HTTP step need the authentification by Active Directory OAuth.{
"$content-type": "multipart/form-data",
"$multipart": [
{
"headers": {
"Content-Disposition": "form-data; name=\"Rapport\"; filename=\"Rapport.pbix\""
},
"body": @{base64ToBinary(triggerBody()?['file']?['contentBytes'])}
}
]
}