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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
smtiwari
Helper I
Helper I

Publish reports using Azure Devops- latest files

Hi All,

 

I am trying to use powershell script to deploy Power BI reports using Azure Devops.

All works well when I use copy and publish task.

All my 100 reports  when checked-in were deployed from  the source repo folder to Power BI.

trigger:
    -master
pool:
  vmImage: 'windows-latest'
steps:
- task: CopyFiles@2
  inputs:
    SourceFolder: '$(Build.SourcesDirectory)/PowerBIreports'
    Contents: '**.pbix'                                                                      
    TargetFolder: '$(Agent.TempDirectory)/$(Build.BuildId)'
- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'PowerBIArtifact'
    publishLocation: 'Container'

However, now I want to deploy only incremental changes using same approach is that possible?

 

Everytime all  the reports get picked up , I tried using below, but I am new to Devops and Powershell and struggling to find the right way, basically get pbix files in latest commit and publish those artifacts only. @amitchandak 

 

trigger:
-master
pool:
  vmImage: 'windows-latest'
steps:
- powershell: |
       #get the changed template
       $a = git diff-tree --no-commit-id --name-only -r $(Build.SourceVersion)  
       
       #assign the filename to a variable        
        
        echo "##vso[task.setvariable variable=fileName]$a" 
- powershell: |
       echo "$env:fileName"     
- task: CopyFiles@2
  inputs:
        SourceFolder: '$(filename)'
        Contents: '**.pbix'
        TargetFolder: '$(Build.ArtifactStagingDirectory)\$(Build.BuildNumber)\PowerBIReports'
- task: PublishBuildArtifacts@1
  inputs:
        PathtoPublish: '$(Build.ArtifactStagingDirectory)\$(Build.BuildNumber)\PowerBIReports'
        ArtifactName: 'PowerBIArtifact'
        publishLocation: 'Container'
1 REPLY 1
v-cazheng-msft
Community Support
Community Support

Hi @smtiwari,

 

Maybe you could consider this solution. Everytime you run the deployment scripts for some reports, you keep the deployment timestamp for them. During the next deployment, check the saved deployment info before the script starts the new deployment and only deploy reports that haven’t been deployed last time.

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let me know. Thanks a lot!

 

Best Regards,

Community Support Team _ Caiyun

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.