Wednesday, April 15, 2020

Installing the PowerShell Power BI Management cmdlets


So I thought this would be a pretty straightforward task. But because I wrote this short post you probably figured out I ran into a couple of issues trying to install the Power BI Management commands for PowerShell.
I should also mention that I think I can say I'm pretty proficient at using the Power Platform products, but I'm still a beginner in the PowerShell world :-)

Prerequisites

For starters, keep in mind the supported environments and PowerShell versions, luckily I met those:
  • Windows PowerShell v3.0 and up with .NET 4.7.1 or above
  • PowerShell Core (v6) and up on any OS platform supported by PowerShell Core

Older versions of MicrosoftPowerBIMgmt

The first hurdle I encountered was the fact that there was already an older version installed. After some fiddling, trying to uninstall the old modules and going through the fixed described below, I figured the documentation was probably the best start, and it was. :-)
You can update to the latest version of the Power BI Management module with the following command:
Update-Module -Name MicrosoftPowerBIMgmt

If you want to uninstall all the Power BI PowerShell cmdlets, run the following in an elevated PowerShell session:
Get-Module MicrosoftPowerBIMgmt* -ListAvailable | Uninstall-Module -Force

Untrusted Repository

The second thing that hit me was this message that kept coming back about an untrusted repository PSGallery.


After some searching I found this blog that has a nice solution: adding the PSGallery to the trusted repositories will get rid of the necessary annoying pop-up:
Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted

Install-Module

I thought I could finally get around to installing the desired module, but unfortunately I ran into another error:

I also tried installing only the Profile cmdlet, but that didn't help and turned up the same warning error.

Going to the link provided for the Source Location actually downloaded the NuGet-package, so the URL seemed valid, just not in PowerShell.

Another Google search got me the solution. Apparently switching to TLS 1.2 solves the problem, so I did:

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12


Now I can finally get around to searching for one of my workspaces with PowerShell :-)


1 comment:

  1. great article. one additional point for the newbie: open your powershell window as administrator

    ReplyDelete

Thanks for taking the time to provide feedback!

Cheers,
Nicky

Featured Post

My DataGrillen Adventure: Speaking, Connecting, and New Friendships

I just got back from an incredible trip to DataGrillen, and I can’t wait to share my experiences with you. If you haven’t heard of it,  Data...