I am trying to deploy and setup Continuous Deployment for MS Fabric project using API's , Currently I am only considering a hello world type files, sample .pbix file and some other report for deployment. My current use case is simple, to make a small change in pbi or any other file and that same should trigger deployment into MS fabric workspace. Which API should I use? and what authenticaion mechanism I should use? Will I need app ID, tenant ID, workspace ID, app secret ? And what else will I need ? I am setting up deployment from local system first.
I am trying to deploy and setup Continuous Deployment for MS Fabric project using API's , Currently I am only considering a hello world type files, sample .pbix file and some other report for deployment. My current use case is simple, to make a small change in pbi or any other file and that same should trigger deployment into MS fabric workspace. Which API should I use? and what authenticaion mechanism I should use? Will I need app ID, tenant ID, workspace ID, app secret ? And what else will I need ? I am setting up deployment from local system first.
Share Improve this question edited Feb 17 at 19:15 VLAZ 29.1k9 gold badges62 silver badges84 bronze badges asked Feb 17 at 7:45 SalmanSalman 1,8696 gold badges15 silver badges28 bronze badges1 Answer
Reset to default 0Per your expectation to import a .pibx
report into your Microsoft Fabric workspace, I tested to use New-PowerBIReport
locally and in Azure Pipelines. Here are the brief steps for your reference.
As introduced in this document, create a service principal (app registration in my example: App-MicrosoftFabric) with the Contributor access to my DevWorkspace;
Navigate to Admin portal -> Enable Service principals can use Fabric APIs;
Generate client secret for the service principal and collect the
tenantId
,clientId
&clientSecret
;Install Microsoft Power BI Cmdlets;
Install-Module -Name MicrosoftPowerBIMgmt -Force -AllowClobber
Test the script locally to import the
.pbix
file and create a new report in the target workspace;# App-MicrosoftFabric $tenantId = "20247162-xxxx-xxxx-xxxx-8ee25c8bdd23" $clientId = "8a40233c-xxxx-xxxx-xxxx-4e577d178b23" $clientSecret = "xxxxxx" # Create secure client secret $secureClientSecret = ConvertTo-SecureString $clientSecret -AsPlainText -Force $credential = New-Object System.Management.Automation.PSCredential($clientId, $secureClientSecret) # Authenticate to Power BI service using the service principal Connect-PowerBIServiceAccount -ServicePrincipal -TenantId $tenantId -Credential $credential # Returns a list of Power BI workspaces Get-PowerBIWorkspace -Name 'DevWorkspace' # Returns a list of Power BI reports Get-PowerBIReport -Workspace ( Get-PowerBIWorkspace -Name 'DevWorkspace' ) # Import PBIX file into the Power BI workspace New-PowerBIReport -Path '.\Tasks - Work.pbix' -Name 'WorkReport' -ConflictAction 'Overwrite' -Workspace ( Get-PowerBIWorkspace -Name 'DevWorkspace' ) Disconnect-PowerBIServiceAccount
Create sample YAML pipeline running on
windows-lastest
agents and define pipeline variables$(tenantId)
,$(clientId)
and$(clientSecret)
for the script to consume;trigger: - dev pool: vmImage: windows-latest steps: - powershell: | # Install MicrosoftPowerBIMgmt module Install-Module -Name MicrosoftPowerBIMgmt -Force -AllowClobber # Define script variables with the values of pipeline variables $tenantId = "$(tenantId)" $clientId = "$(clientId)" $clientSecret = "$(clientSecret)" # Create secure client secret $secureClientSecret = ConvertTo-SecureString $clientSecret -AsPlainText -Force $credential = New-Object System.Management.Automation.PSCredential($clientId, $secureClientSecret) # Authenticate to Power BI service using the service principal Connect-PowerBIServiceAccount -ServicePrincipal -TenantId $tenantId -Credential $credential # Returns a list of Power BI workspaces Get-PowerBIWorkspace -Name 'DevWorkspace' # Returns a list of Power BI reports Get-PowerBIReport -Workspace ( Get-PowerBIWorkspace -Name 'DevWorkspace' ) # Import PBIX file into the Power BI workspace New-PowerBIReport -Path '$(System.DefaultWorkingDirectory)\Reports\Tasks - Work.pbix' -Name 'WorkReport' -Workspace ( Get-PowerBIWorkspace -Name 'DevWorkspace' ) Disconnect-PowerBIServiceAccount
The sample pipeline uses a simple CI trigger. You may specify path filters to the .pbix
files in your repo based on your needs.