{"id":3094,"date":"2019-04-23T11:52:51","date_gmt":"2019-04-23T10:52:51","guid":{"rendered":"https:\/\/www.lieben.nu\/liebensraum\/?p=3094"},"modified":"2019-04-23T11:52:51","modified_gmt":"2019-04-23T10:52:51","slug":"import-a-pbix-to-powerbi-using-powershell","status":"publish","type":"post","link":"https:\/\/lieben.nu\/liebensraum\/2019\/04\/import-a-pbix-to-powerbi-using-powershell\/","title":{"rendered":"Import a PBIX to PowerBI using PowerShell"},"content":{"rendered":"\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"431\" height=\"67\" src=\"https:\/\/www.lieben.nu\/liebensraum\/wp-content\/uploads\/2019\/04\/2019-04-23-12_48_40-Windows-PowerShell-ISE.png\" alt=\"\" class=\"wp-image-3096\" srcset=\"https:\/\/lieben.nu\/liebensraum\/wp-content\/uploads\/2019\/04\/2019-04-23-12_48_40-Windows-PowerShell-ISE.png 431w, https:\/\/lieben.nu\/liebensraum\/wp-content\/uploads\/2019\/04\/2019-04-23-12_48_40-Windows-PowerShell-ISE-300x47.png 300w\" sizes=\"auto, (max-width: 431px) 100vw, 431px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Reading up on the <a rel=\"noreferrer noopener\" aria-label=\"PowerBI API to import PBIX files (opens in a new tab)\" href=\"https:\/\/docs.microsoft.com\/en-us\/rest\/api\/power-bi\/imports\/postimport\" target=\"_blank\">PowerBI API to import PBIX files<\/a> to the PowerBI service and an <a rel=\"noreferrer noopener\" aria-label=\"example on the actual request (opens in a new tab)\" href=\"https:\/\/powerbi.microsoft.com\/fr-fr\/blog\/upload-a-local-pbix-file-using-the-import-api\/\" target=\"_blank\">example on the actual request<\/a> I decided to write a PowerShell function to import a PowerBI PBIX file to the PowerBI service.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The PowerBI Import API is quite specific and kept giving me 400&#8217;s like:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>&#8220;Bad Request&#8221;  with no details<\/li><li>UnknownError pbi.error exceptionCulprit 1 (loved this one)<\/li><li>MultiPartMimeStreamFormatException<\/li><li>RequestedFileIsEncryptedOrCorrupted<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Eventually I figured out how to import my reports directly into PowerBI, so to help you automate importing your reports into workspaces or directly to customers using PowerShell, I&#8217;ll share my PowerShell function with you: <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">GitLab: <a href=\"https:\/\/gitlab.com\/Lieben\/assortedFunctions\/blob\/master\/Import-PBIXToPowerBI.ps1\">Import-PBIXToPowerBI.ps1<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Reading up on the PowerBI API to import PBIX files to the PowerBI service and an example on the actual request I decided to write a PowerShell function to import a PowerBI PBIX file to the PowerBI service. The PowerBI Import API is quite specific and kept giving me 400&#8217;s like: &#8220;Bad Request&#8221; with no &hellip; <a href=\"https:\/\/lieben.nu\/liebensraum\/2019\/04\/import-a-pbix-to-powerbi-using-powershell\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Import a PBIX to PowerBI using PowerShell<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[4,38,39],"tags":[],"class_list":["post-3094","post","type-post","status-publish","format-standard","hentry","category-automation","category-powerbi","category-powershell"],"_links":{"self":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts\/3094","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/comments?post=3094"}],"version-history":[{"count":0,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts\/3094\/revisions"}],"wp:attachment":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/media?parent=3094"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/categories?post=3094"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/tags?post=3094"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}