Forum Discussion

MartinMason's avatar
MartinMason
Resolver I
1 year ago
Solved

Automate Deployment to Test; Deployment Pipelines, Power BI Automation Tools, and Azure Devops

Our plan was to automate deployment from Dev to Test by calling the Power BI Automation Tools extension to execute a Power BI Deployment pipeline. Our yaml looks like the following:

 

 

 

- task: DeploymentPipelines-Deploy@1
  inputs:
    pbiConnection: 'Service Principal Connection'
    pipeline: '{ pipelineId} '
    stageOrder: 'Test'
    note: 'Deploy all content from Dev to Test'
    waitForCompletion: true
    createNewWS: false
    allowCreateArtifact: true
    allowOverwriteArtifact: true
    updateApp: false
    allowOverwriteTargetArtifactLabel: false
    allowPurgeData: false
    allowSkipTilesWithMissingPrerequisites: false
    allowTakeOver: true

 

 

 

The service connection works and has the correct permissions on both Dev and Test workspaces as well as being an Admin on the Deployment pipeline. Everything seems to work fine until it doesn't. The log of the call from above is below which is not very useful.

 

 

 

##[debug]+ Start-PipelineDeployment -ActivityId $activityId -Endpoint $endpoint  ...
##[debug]+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
##[debug]    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
##[debug]    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Start-PipelineDeployment
##[debug] 
##[debug]Script stack trace:
##[debug]at Start-PipelineDeployment, D:\a\_tasks\DeploymentPipelines-Deploy_387b9cad-cfe0-4502-b150-301f8942e8b7\1.2.0\ps_modules\PowerBIApiUtils\PowerBIApiUtils.psm1: line 475
##[debug]at <ScriptBlock>, D:\a\_tasks\DeploymentPipelines-Deploy_387b9cad-cfe0-4502-b150-301f8942e8b7\1.2.0\Run.ps1: line 25
##[debug]at <ScriptBlock>, <No file>: line 1
##[debug]at <ScriptBlock>, <No file>: line 22
##[debug]at <ScriptBlock>, <No file>: line 18
##[debug]at <ScriptBlock>, <No file>: line 1
##[debug]Exception:
##[debug]Microsoft.PowerShell.Commands.WriteErrorException: Deployment completed with status: Failed, Operation Id: aac580b6-7ee6-4894-a250-b453a763867c
##[error]Deployment completed with status: Failed, Operation Id: aac580b6-7ee6-4894-a250-b453a763867c
##[debug]Processed: ##vso[task.logissue type=error]Deployment completed with status: Failed, Operation Id: aac580b6-7ee6-4894-a250-b453a763867c
##[debug]Processed: ##vso[task.complete result=Failed]

 

 

 

I've exhausted all ideas. Is the Power BI Automation Tools just not up to snuff? Has anyone else successfully achieved deployment of Power BI content from Dev to Test to Prod and if so, what approach did you use?

  • Hi MartinMason  - Automating Power BI deployment pipelines using the Power BI Automation Tools is a common approach but can present challenges, especially with vague error messages like the one you've encountered. 

    Your YAML configuration looks mostly correct. However, double-check the following:

    Pipeline ID:

    Ensure that { pipelineId } is correctly replaced with the actual pipeline ID from Power BI Service.
    Stage Order:

    The stageOrder must match the exact name of the stage in your deployment pipeline, e.g., Test. Ensure there are no typos or extra spaces.
    Permissions of Service Principal:

    Verify that the Service Principal is an Admin on both workspaces and the deployment pipeline. Additionally, ensure it has Contributor access to the Azure AD App.

    The error occurs in the Start-PipelineDeployment function within the PowerShell script. To debug:

    Add Debug Logs:

    Modify the script to include additional logging around the Start-PipelineDeployment function to capture more details about the failure.
    Run the Script Locally:

    Try running the deployment pipeline script locally using PowerShell to isolate whether the issue is specific to the Azure DevOps environment.
    4. Verify Automation Tools Extension
    The Power BI Automation Tools extension is still relatively new and may have limitations. Ensure you are using the latest version of the extension.

     

     

    Use parameterized datasets to ensure smooth deployment across environments without manual adjustments.
    Deploy only the content that changed instead of the entire workspace to reduce the chances of failure.
    Configure rules for datasets, parameters, and other artifacts to handle environment-specific settings.

6 Replies

  • Hi MartinMason  - Automating Power BI deployment pipelines using the Power BI Automation Tools is a common approach but can present challenges, especially with vague error messages like the one you've encountered. 

    Your YAML configuration looks mostly correct. However, double-check the following:

    Pipeline ID:

    Ensure that { pipelineId } is correctly replaced with the actual pipeline ID from Power BI Service.
    Stage Order:

    The stageOrder must match the exact name of the stage in your deployment pipeline, e.g., Test. Ensure there are no typos or extra spaces.
    Permissions of Service Principal:

    Verify that the Service Principal is an Admin on both workspaces and the deployment pipeline. Additionally, ensure it has Contributor access to the Azure AD App.

    The error occurs in the Start-PipelineDeployment function within the PowerShell script. To debug:

    Add Debug Logs:

    Modify the script to include additional logging around the Start-PipelineDeployment function to capture more details about the failure.
    Run the Script Locally:

    Try running the deployment pipeline script locally using PowerShell to isolate whether the issue is specific to the Azure DevOps environment.
    4. Verify Automation Tools Extension
    The Power BI Automation Tools extension is still relatively new and may have limitations. Ensure you are using the latest version of the extension.

     

     

    Use parameterized datasets to ensure smooth deployment across environments without manual adjustments.
    Deploy only the content that changed instead of the entire workspace to reduce the chances of failure.
    Configure rules for datasets, parameters, and other artifacts to handle environment-specific settings.

    • MartinMason's avatar
      MartinMason
      Resolver I

      Thank you for your response and for confirming that the configuration of the pipeline task was correct. I think I figured out my issue though error reporting from pipeline executions wasn't much help.

       

      Our solution consists of a single Fabric workspace composed of a single semantic model and a whole host of Power BI reports that reference that single semantic model. The semantic model references a Fabric lakehouse in another workspace. The service principal used to call the Deployment Pipeline had the correct permissions on the Deployment Pipeline, the source workspace, and the target workspace, but didn't have permissions on the Fabric lakehouse that the semantic model uses as it's single source. Duh. I should have realized that earlier. 

      • rajendraongole1's avatar
        rajendraongole1
        Super User

        Hi MartinMason - Ah, that makes perfect sense! It’s easy to overlook permissions on a downstream data source like the Fabric lakehouse, especially when all the focus is on the pipeline, source workspace, and target workspace.

        you can check on the grant the Service Principal Access to the Lakehouse:

        Assign the appropriate role (e.g., Contributor or Reader) to the service principal for the Fabric lakehouse.
        Test the Connection:

        From the Dev workspace, verify the semantic model can refresh or connect using the service principal before initiating the deployment pipeline.
        Document Cross-Workspace Dependencies:

        Maintain a clear map of dependencies between workspaces and ensure the service principal has the necessary permissions on all referenced resources.

         

        Glad you figured it out. Thank you.

  • v-pnaroju-msft's avatar
    v-pnaroju-msft
    Community Support

    Hi MartinMason,

    We are happy to learn that your issue has been resolved. To help others in the community, kindly mark the response that resolved your query as the accepted solution.

    For any further assistance or questions, please continue to engage with the Fabric Community.

     

    Best regards,

    Pavan

  • v-pnaroju-msft's avatar
    v-pnaroju-msft
    Community Support

    Hi MartinMason,

     

    We are pleased to hear that your issue has been resolved. Kindly mark the response that resolved your issue as the accepted solution. This will help other community members facing similar challenges to find solutions more efficiently.

    Please continue using Fabric Community for any help regarding your queries.

     

    Thank you.

  • v-pnaroju-msft's avatar
    v-pnaroju-msft
    Community Support

    Hi MartinMason,

     

    We are delighted to know that your issue has been resolved. Kindly mark the response that resolved your query as the accepted solution. This will assist other community members facing similar challenges in finding solutions more efficiently.

    Please continue using Fabric Community for any help regarding your queries.

     

    Thank you.