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

Powershell function to invoke compiling Power BI Projects to Report files and deploy to On-Prem Report Server via DevOps Pipelin

programmeradmin6浏览0评论

We have just put our Power BI reports (PBIX files) into a Git Repo as Power BI Projects (PBIP project folders) and I've started building out a DevOps Release Pipeline to release the reports to a test server. In Microsoft docs I can see that you can deploy PBIX report files. Is there a function I can invoke to transform from a project to a report file and deploy to the server?

Any help is appreciated.

Thanks, Dan

PowerShell Script

Get-ChildItem -Path "$FolderPath\*.pbix" | ForEach-Object {
    $ReportName = $_.Name
    Write-Host "Deploying $ReportName to $ReportServerURL"

    Invoke-WebRequest -Uri "$ReportServerURL/api/v2.0/CatalogItems" `
                      -Method Post `
                      -Credential $cred `
                      -InFile $_.FullName `
                      -ContentType "application/octet-stream"
}

DevOps Pipeline

trigger:
- main 

stages:
- stage: Build
  displayName: 'Build Reports'
  jobs:
  - job: Build
    displayName: 'Validate'
    pool:
      name: 'Self-Hosted'
    steps:
    - checkout: self 
    - task: PublishBuildArtifacts@1
      displayName: 'Publish Reports as Artifacts'
      inputs:
        artifactName: 'PBIReports'
        pathToPublish: '$(Build.SourcesDirectory)' 



- stage: Deploy
  displayName: 'Deploy to Report Server'
  jobs:
  - deployment: DeployPBIRS
    displayName: 'Deploy Reports to PBIRS'
    environment: Test
    pool:
      name: 'Self-Hosted'
    strategy:
      runOnce:
        deploy:
          steps:
          - download: current
            artifact: 'PBIReports'

          - task: PowerShell@2
            displayName: 'Deploy Reports to PBIRS'
            inputs:
              filePath: '$(Pipeline.Workspace)/PBI.ps1' 
              arguments: '-ReportServerURL "http://your-pbirs-server/reports" -FolderPath "$(Pipeline.Workspace)/Reports" -Username "admin" -Password "$(PBIRSPassword)"'
              failOnStderr: true

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论