Reply
alexkarwoski
Frequent Visitor

Using Report Meta Data with Power Bi and Power Automate

I need to pass the Report Name or report ID to the power automate flow linked through a button sitting on the power BI report. Is this possible? I want to make a flow that works across reports, because I know the tab names and the filters will be the same. The report will be different however.

Thanks

1 ACCEPTED SOLUTION

Hi @alexkarwoski 

 

Sorry for late.

There was a slight misunderstanding in the previous reply. I think you want to pass the report ID/name of the report in the workspace into flow as a field in the Power Automate visual.

 

Please try the following steps:

1. Getting report information in the workspace via PowerShell

Run PowerShell ISE as administrator and use the following command to install the Power BI module:

Install-Module -Name MicrosoftPowerBIMgmt

Run the following script to get the report information and save it into a csv file:

Connect-PowerBIServiceAccount
$Workspaces = Get-PowerBIWorkspace -All
$Reports = @()
ForEach ($workspace in $Workspaces) {
    Write-Host $workspace.Name
    $workspaceReports = Get-PowerBIReport -WorkspaceId $workspace.Id
    ForEach ($report in $workspaceReports) {
        $reportInfo = [pscustomobject]@{
            WorkspaceName = $workspace.Name
            WorkspaceID = $workspace.Id
            ReportName = $report.Name
            ReportID = $report.Id
        }
        $Reports += $reportInfo
    }
}
$Dir = "C:\Users\YourPCUserName\Desktop\Reports.csv"
$Reports | Export-Csv $Dir -NoTypeInformation -Encoding UTF8
Disconnect-PowerBIServiceAccount

 

 2. Import the csv file into your Power BI report, create Power Automate visual in the report, drag the WorkspaceID, ReportID, ReportName fields from the csv file into the visual.

Click on the visual ellipsis and select Edit, choose existing flow or create a new flow, the flow is as follows:

vxianjtanmsft_5-1731060165059.pngvxianjtanmsft_0-1731059288880.png

On Power BI button clicked -> Export to File for Power BI Reports -> Create file

vxianjtanmsft_1-1731059368534.png

In the “Export To File for Power BI Report” action, drag and drop WorkspaceID, ReportID into it.

vxianjtanmsft_2-1731059685673.png

In the “Create file” action, fill in the information about the SharePoint site, use the content returned from the “Export To File for Power BI Report” action as the “File Content”, and use the following expression as the “File Name”:

concat(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(items('Apply_to_each')?['ReportName'], '#', ''), '%', ''), '*', ''), ':', ''), '<', ''), '>', ''), '?', ''), '/', ''), '|', ''), ' ', '_'), '_', utcNow(), '.pdf')

vxianjtanmsft_3-1731059975568.pngvxianjtanmsft_4-1731060028613.png

 

3. Select Save and Apply, then back to the report and click the button to run flow.

vxianjtanmsft_6-1731060239540.png

 

vxianjtanmsft_7-1731060330267.png

 

Best Regards,
Jarvis Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

View solution in original post

3 REPLIES 3
v-xianjtan-msft
Community Support
Community Support

Hi @alexkarwoski 

 

You can use the Power BI REST API to get the report ID by adding an HTTP request step in Power Automate to call the API, parsing the API response and extracting the report ID, and then passing this information to the subsequent steps.

GET https://api.powerbi.com/v1.0/myorg/reports/{reportId}

Reports - Get Report - REST API (Power BI Power BI REST APIs) | Microsoft Learn

Create a Power Automate visual for Power BI - Power BI | Microsoft Learn

 

 

Best Regards,
Jarvis Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thankyou for the reply @v-xianjtan-msft !

However, what do I use to call the API. Like what parameters would I be passing to the API? Because this paramter would need to be passed through the Power Automate button that is sitting in Power BI, correct? I want to have a bunch of users be able to implement the button that will print PDFs of their reports, so I need the information to scale dynamically.

 

Thanks 

Hi @alexkarwoski 

 

Sorry for late.

There was a slight misunderstanding in the previous reply. I think you want to pass the report ID/name of the report in the workspace into flow as a field in the Power Automate visual.

 

Please try the following steps:

1. Getting report information in the workspace via PowerShell

Run PowerShell ISE as administrator and use the following command to install the Power BI module:

Install-Module -Name MicrosoftPowerBIMgmt

Run the following script to get the report information and save it into a csv file:

Connect-PowerBIServiceAccount
$Workspaces = Get-PowerBIWorkspace -All
$Reports = @()
ForEach ($workspace in $Workspaces) {
    Write-Host $workspace.Name
    $workspaceReports = Get-PowerBIReport -WorkspaceId $workspace.Id
    ForEach ($report in $workspaceReports) {
        $reportInfo = [pscustomobject]@{
            WorkspaceName = $workspace.Name
            WorkspaceID = $workspace.Id
            ReportName = $report.Name
            ReportID = $report.Id
        }
        $Reports += $reportInfo
    }
}
$Dir = "C:\Users\YourPCUserName\Desktop\Reports.csv"
$Reports | Export-Csv $Dir -NoTypeInformation -Encoding UTF8
Disconnect-PowerBIServiceAccount

 

 2. Import the csv file into your Power BI report, create Power Automate visual in the report, drag the WorkspaceID, ReportID, ReportName fields from the csv file into the visual.

Click on the visual ellipsis and select Edit, choose existing flow or create a new flow, the flow is as follows:

vxianjtanmsft_5-1731060165059.pngvxianjtanmsft_0-1731059288880.png

On Power BI button clicked -> Export to File for Power BI Reports -> Create file

vxianjtanmsft_1-1731059368534.png

In the “Export To File for Power BI Report” action, drag and drop WorkspaceID, ReportID into it.

vxianjtanmsft_2-1731059685673.png

In the “Create file” action, fill in the information about the SharePoint site, use the content returned from the “Export To File for Power BI Report” action as the “File Content”, and use the following expression as the “File Name”:

concat(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(items('Apply_to_each')?['ReportName'], '#', ''), '%', ''), '*', ''), ':', ''), '<', ''), '>', ''), '?', ''), '/', ''), '|', ''), ' ', '_'), '_', utcNow(), '.pdf')

vxianjtanmsft_3-1731059975568.pngvxianjtanmsft_4-1731060028613.png

 

3. Select Save and Apply, then back to the report and click the button to run flow.

vxianjtanmsft_6-1731060239540.png

 

vxianjtanmsft_7-1731060330267.png

 

Best Regards,
Jarvis Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

Check out the March 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)