Power BI Embedded service has been something that I’ve avoided using because of its costs. Leaving it running for a month cost hundreds of euros.
We had a company-wide hackathon earlier last year where we created a Power Automate flow that starts the Power BI Embedded capacity, exports a report as a PDF with the use of Power BI REST API and after generating the pdf file, the Embedded capacity is suspended so it won’t accrue costs unnecessarily.
The reason for this approach is that you are not able to use the Power BI REST API’s Export as a file – functionality without the capacity, which is usually not possible for small companies.
The solution is to trigger Azure automation workbooks from Power Automate / Logic Apps to start and stop the capacity:
To start the capacity, use the following PowerShell script in the automation workbook:
Write-Host “Power BI Embedded – Resume PowerBI Embedded Cmdlet”
#Connect to Azure
Connect-AzAccount
Set-AzContext -Subscription “abcdefg-1234-5333-aaa4-bbbbbbbbb”#Test PBI Embedded Existence
$capExists = Test-AzPowerBIEmbeddedCapacity -Name “ffappbiembedded”if($capExists -eq true) {
#Suspend
Resume-AzPowerBIEmbeddedCapacity -Name “ffappbiembedded” -ResourceGroupName “FF_APP”
}
else {
Write-Host “Power BI Embedded Capacity not found”}
To suspend it, use the following:
Write-Host “Power BI Embedded – Suspend PowerBI Embedded Cmdlet”
#Connect to Azure
Connect-AzAccount
Set-AzContext -Subscription “abcdefg-1234-5333-aaa4-bbbbbbbbb”#Test PBI Embedded Existence
$capExists = Test-AzPowerBIEmbeddedCapacity -Name “ffappbiembedded”if($capExists -eq true) {
#Suspend
Suspend-AzPowerBIEmbeddedCapacity -Name “ffappbiembedded” -ResourceGroupName “FF_Embedded”
}
else {
Write-Host “Power BI Embedded Capacity not found”
}
Thank you, João, for figuring out the PowerShell scripts!