最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

MS Fabric project Deployment using Azure Pipelines - Stack Overflow

programmeradmin4浏览0评论

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 badges
Add a comment  | 

1 Answer 1

Reset to default 0

Per 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.

  1. As introduced in this document, create a service principal (app registration in my example: App-MicrosoftFabric) with the Contributor access to my DevWorkspace;

  2. Navigate to Admin portal -> Enable Service principals can use Fabric APIs;

  3. Generate client secret for the service principal and collect the tenantId, clientId & clientSecret;

  4. Install Microsoft Power BI Cmdlets;

    Install-Module -Name MicrosoftPowerBIMgmt -Force -AllowClobber
    
  5. 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
    
  6. 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.

发布评论

评论列表(0)

  1. 暂无评论