Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Duplicate reports are creating while deploying the report using Azure DevOps pipeline

HI Team,

 

Test Case 1:

I am trying to deploy PBIX file (which is having only Report) into PowerBI service using Azure DevOps services using CI CD pipelines. While am trying to deploy it's duplicating the reports even am trying to provide as Overwrite argument using powershell and also it is not overwriting the existing one. 

 

New-PowerBIReport -Path $reportPath -Name $reportName -WorkspaceId $workspaceId -ConflictAction Overwrite

 

2 REPLIES 2
Anonymous
Not applicable

https://gallery.technet.microsoft.com/AzureDevOps-CICD-for-fefd58b8
Provided link is not working, We have two workspaces 1 workspace for Dataset and 1 workspace for Report.

 

When we are deploying the report using Devops pipelines the report is not being overwrite it is creating the new report id

 

steps:
# Step 1: Copy PBIX File to Artifact Staging Directory
taskCopyFiles@2
  displayName'Copy PBIX File'
  inputs:
    SourceFolder'$(Build.SourcesDirectory)'
    Contents'${{ parameters.reportName }}.pbix'
    TargetFolder'$(Build.ArtifactStagingDirectory)'
    OverWritetrue

# Step 2: Publish Build Artifacts (PBIX file)
taskPublishBuildArtifacts@1
  displayName'Publish Build Artifacts'
  inputs:
    PathtoPublish'$(Build.ArtifactStagingDirectory)'
    ArtifactName'drop'
    publishLocation'Container'

taskmaikvandergaag.maikvandergaag-power-bi-actions.PowerBIActions.PowerBIActions@5
  displayName'Report Deployment'
  inputs:
    PowerBIServiceEndpoint'Power BI for CICD'
    WorkspaceName${{ parameters.ReportWorkspaceName }}
    PowerBIPath'$(System.DefaultWorkingDirectory)/${{ parameters.reportName }}.pbix'
    Overwritetrue
    Createfalse


# # Step 3: Report Deployment using Azure CLI (Replace or Create Report)
# - task: AzureCLI@2
#   displayName: 'Report Deployment'
#   inputs:
#     azureSubscription: 'Power Bi Service Principal'
#     scriptType: ps
#     scriptLocation: inlineScript
#     inlineScript: |
#       Install-Module -Name MicrosoftPowerBIMgmt -Scope CurrentUser -Force -AllowClobber
#       Import-Module MicrosoftPowerBIMgmt
#       # Set up Service Principal credentials
#       $applicationId = "<Client-id>"
#       $securePassword = "<Secure-Password>" | ConvertTo-SecureString -AsPlainText -Force
#       $credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $applicationId, $securePassword
#       $tenantId = "<Tenant-ID>"

#       # Connect to Power BI Service using Service Principal
#       Connect-PowerBIServiceAccount -ServicePrincipal -Credential $credential -TenantId $tenantId

#       # Define variables
#       $workspaceName = "<reportName>"  # Name of the workspace
#       $workspaceId = (Get-PowerBIWorkspace -Name $workspaceName).Id  # Dynamically retrieve workspace ID
#       $reportPath = '$(System.DefaultWorkingDirectory)/${{ parameters.reportName }}.pbix'  # Path to the PBIX file
#       $reportName = "CI-CD Test"  # Name of the report in Power BI

#       if (-Not $workspaceId) {
#           Write-Host "Workspace '$workspaceName' not found. Please check the workspace name."
#           exit
#       }

#       if (-Not (Test-Path $reportPath)) {
#           Write-Host "Report file not found at path '$reportPath'. Please check the file path."
#           exit
#       }

#       try {
#           # Get the existing report in the workspace
#           $existingReport = Get-PowerBIReport -WorkspaceId $workspaceId | Where-Object { $_.Name -eq $reportName }

#           if ($existingReport) {
#               # Get the report ID of the existing report
#               $reportId = $existingReport.Id
#               Write-Host "Existing report found. Report ID: $reportId"

#               # Replace the report using Import-PowerBIReport with -ConflictAction Replace
#               New-PowerBIReport -Path $reportPath -WorkspaceId $workspaceId -ConflictAction Overwrite
#               Write-Host "Report '$reportName' (ID: $reportId) successfully replaced in workspace '$workspaceId'."
#           } else {
#               # Create a new report if it doesn't exist
#               New-PowerBIReport -Path $reportPath -WorkspaceId $workspaceId
#               Write-Host "Report '$reportName' successfully created in workspace '$workspaceId'."
#           }
#       } catch {
#           Write-Host "An error occurred: $_"
#       }
#     addSpnToEnvironment: true

# Step 4: Dataset Deployment
taskPowerBIActions@5
  displayName'Dataset Deployment'
  inputs:
    PowerBIServiceEndpoint'$(powerBIServiceEndpoint)'
    WorkspaceName${{ parameters.DatasetWorkspaceName }}
    PowerBIPath'$(System.DefaultWorkingDirectory)/${{ parameters.reportName }}.pbix'

# Step 5: Dataset Rebinding (Rebind report to the dataset)
taskPowerBIActions@5
  displayName'Dataset Update'
  inputs:
    PowerBIServiceEndpoint'$(powerBIServiceEndpoint)'
    Action'RebindReport'
    CrossWorkspaceRebindingtrue
    WorkspaceName${{ parameters.DatasetWorkspaceName }}
    ReportWorkspaceName${{ parameters.ReportWorkspaceName }}
    DatasetName${{ parameters.reportName }}
    ReportName${{ parameters.reportName }}
Anonymous
Not applicable

Hi, @Anonymous 

I am glad to help you.

 

First you need to make sure that all the parameters (e.g. $reportPath, $reportName, $workspaceId) in the PowerShell command are correct.


Then you can verify that the permissions are set correctly between the Azure DevOps service and the PowerBI service to ensure that there are permissions to override the report.


You can also try deploying using the PowerBI REST API, which may provide more control and options.

 

And you can also check out this blog which helps you understand the CICD for Azure DevOps:

PowerBI - CICD using Azure DevOps - Microsoft Fabric Community

 

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.
Best Regards,
Fen Ling,
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors