{"id":1174,"date":"2022-04-10T11:06:50","date_gmt":"2022-04-10T09:06:50","guid":{"rendered":"https:\/\/www.flip-design.de\/?p=1174"},"modified":"2022-04-10T11:06:50","modified_gmt":"2022-04-10T09:06:50","slug":"deploy-power-bi-paginated-reports-with-azure-devops-in-a-continuous-deployment-scenario","status":"publish","type":"post","link":"https:\/\/www.flip-design.de\/?p=1174","title":{"rendered":"Deploy Power BI Paginated Reports with Azure DevOps in a Continuous Deployment scenario"},"content":{"rendered":"\n<p>To deploy Power BI reports I have written in the past a blog post: <a href=\"https:\/\/www.flip-design.de\/?p=1092\">https:\/\/www.flip-design.de\/?p=1092<\/a> But, if you have also Pagenated Reports, these must be also deployed to theworkspace to move them with the Power BI deployment pipelines to the different stages.<br>so, for example I created a simple report and deployed them to my workspace:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2022\/04\/image-11.png\"><img decoding=\"async\" loading=\"lazy\" width=\"945\" height=\"503\" src=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2022\/04\/image-11.png\" alt=\"\" class=\"wp-image-1175\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2022\/04\/image-11.png 945w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2022\/04\/image-11-300x160.png 300w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2022\/04\/image-11-768x409.png 768w\" sizes=\"(max-width: 945px) 100vw, 945px\" \/><\/a><\/figure>\n\n\n\n<p>Next, I have added the RDL file to an Azure DevOps repo. To deploy the reports, there is no Task inside DevOps pipelines available, but to achieve a deployment, I created a small PowerShell script.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;CmdletBinding()]\r\nparam (\r\n    $ParamUser,\r\n    $ParamPassword,\r\n    $Paramreport,\r\n    $ParamGroupId\r\n)\r\n\r\n$Path = \"abc\"\r\nfunction Publish-ImportRDLFile \r\n{\r\n    param\r\n    (\r\n        &#91;string]$RdlFilePath,\r\n        &#91;string]$GroupId,\r\n        &#91;string]$nameConflict = \"Overwrite\"\r\n    )\r\n\r\n    # Get file content and create body\r\n    $fileName = &#91;IO.Path]::GetFileName($RdlFilePath)\r\n    $boundary = &#91;guid]::NewGuid().ToString()\r\n    $fileBody = Get-Content -Path $RdlFilePath -Encoding UTF8\r\n\r\n    $body = @\"\r\n---------FormBoundary$boundary\r\nContent-Disposition: form-data; name=\"$filename\"; filename=\"$filename\"\r\nContent-Type: application\/rdl\r\n\r\n$fileBody \r\n---------FormBoundary$boundary--\r\n\r\n\"@\r\n\r\n    # Get AccessToken and set it as header.\r\n    $headers = Get-PowerBIAccessToken\r\n\r\n    $url = \"https:\/\/api.powerbi.com\/v1.0\/myorg\/groups\/$GroupId\/imports?datasetDisplayName=$Paramreport&amp;nameConflict=$nameConflict\"\r\n\r\n    # Create import\r\n    $report = Invoke-RestMethod -Uri $url -Method Post -Headers $headers -Body $body -ContentType \"multipart\/form-data\"   \r\n    $report.id\r\n}\r\n\r\n$moduleName = \"MicrosoftPowerBIMgmt.Profile\"\r\n$module = Get-Module $moduleName -ListAvailable -ErrorAction SilentlyContinue\r\n\r\nif (!$module) \r\n{\r\n\tInstall-Module -Name $moduleName -Force -Scope CurrentUser -SkipPublisherCheck \r\n}\r\n\r\n$myPassword = $ParamPassword\r\n$myUsername = $ParamUser\r\n\r\n$password = ConvertTo-SecureString $myPassword -AsPlainText -Force\r\n$credential = New-Object System.Management.Automation.PSCredential ($myUsername, $password)\r\n\r\nLogin-PowerBIServiceAccount -Credential $credential\r\n# End Parameters =======================================\r\n\r\nPublish-ImportRDLFile -GroupId $groupId -RdlFilePath $report<\/code><\/pre>\n\n\n\n<p>Next, I\u2019ve added the script also to a repo.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2022\/04\/image-12.png\"><img decoding=\"async\" loading=\"lazy\" width=\"945\" height=\"503\" src=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2022\/04\/image-12.png\" alt=\"\" class=\"wp-image-1176\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2022\/04\/image-12.png 945w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2022\/04\/image-12-300x160.png 300w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2022\/04\/image-12-768x409.png 768w\" sizes=\"(max-width: 945px) 100vw, 945px\" \/><\/a><\/figure>\n\n\n\n<p>Then I have created a release pipeline by using an Azure PowerShell task to call the script and provide the parameters.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2022\/04\/image-13.png\"><img decoding=\"async\" loading=\"lazy\" width=\"945\" height=\"503\" src=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2022\/04\/image-13.png\" alt=\"\" class=\"wp-image-1177\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2022\/04\/image-13.png 945w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2022\/04\/image-13-300x160.png 300w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2022\/04\/image-13-768x409.png 768w\" sizes=\"(max-width: 945px) 100vw, 945px\" \/><\/a><\/figure>\n\n\n\n<p>After running the pipeline, the new RDL file was successfully deployed.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2022\/04\/image-14.png\"><img decoding=\"async\" loading=\"lazy\" width=\"945\" height=\"503\" src=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2022\/04\/image-14.png\" alt=\"\" class=\"wp-image-1178\" srcset=\"https:\/\/www.flip-design.de\/wp-content\/uploads\/2022\/04\/image-14.png 945w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2022\/04\/image-14-300x160.png 300w, https:\/\/www.flip-design.de\/wp-content\/uploads\/2022\/04\/image-14-768x409.png 768w\" sizes=\"(max-width: 945px) 100vw, 945px\" \/><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>To deploy Power BI reports I have written in the past a blog post: https:\/\/www.flip-design.de\/?p=1092 But, if you have also Pagenated Reports, these must be also deployed to theworkspace to move them with the Power BI deployment pipelines to the &hellip; <a href=\"https:\/\/www.flip-design.de\/?p=1174\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.flip-design.de\/index.php?rest_route=\/wp\/v2\/posts\/1174"}],"collection":[{"href":"https:\/\/www.flip-design.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.flip-design.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1174"}],"version-history":[{"count":1,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=\/wp\/v2\/posts\/1174\/revisions"}],"predecessor-version":[{"id":1179,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=\/wp\/v2\/posts\/1174\/revisions\/1179"}],"wp:attachment":[{"href":"https:\/\/www.flip-design.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1174"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1174"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.flip-design.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1174"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}