cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dhruvin Member
Member

Unable to Connect with Power BI Service using PowerShell

I have installed PowerShell for Power BI using following Code. 

 

Install-Module -Name MicrosoftPowerBIMgmt

 

It is installed successfully.

2018-08-08_9-55-31.png

Now, I used following code-snippet to connect with Power BI Service.

 

Login-PowerBI

When I executed the code it shows me an error like:

Login-PowerBI : The 'Login-PowerBI' command was found in the module 'MicrosoftPowerBIMgmt.Profile', but the module 
could not be loaded. For more information, run 'Import-Module MicrosoftPowerBIMgmt.Profile'.
At line:1 char:1
+ Login-PowerBI
+ ~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Login-PowerBISmiley Frustratedtring) [], CommandNotFoundException
    + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

Please refer the screenshot.

Screenshot_4.png

 

 

I have also tried to import  module MicrosoftPowerBIMgmt.Profile using following code:

Import-Module MicrosoftPowerBIMgmt.Profile

It shows me following error:

Import-Module : Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, 
PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. Reference assemblies should not be loaded for 
execution.  They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)
At line:1 char:1
+ Import-Module MicrosoftPowerBIMgmt.Profile
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Smiley Happy [Import-Module], BadImageFormatException
    + FullyQualifiedErrorId : System.BadImageFormatException,Microsoft.PowerShell.Commands.ImportModuleCommand
 

Below is a screenshot for the same.

Untitled.png

 

Please suggest an appropriate solution for it

1 ACCEPTED SOLUTION

Accepted Solutions
JaneLHunt Frequent Visitor
Frequent Visitor

Re: Unable to Connect with Power BI Service using PowerShell

Hello

 

I was unable to connect with the Power BI Service with .Net Framework 4.7.02053 installed on my PC.  However, when .Net Framework 4.7.2 was installed from here, I found that I was then able to connect to the Power BI Service using Powershell and run the other PowerShell Management Cmdlets which call the Rest API. 

8 REPLIES 8
lordtopcat Frequent Visitor
Frequent Visitor

Re: Unable to Connect with Power BI Service using PowerShell

I am getting exactly the same errors. I would very much appreciate some help too.

Community Support Team
Community Support Team

Re: Unable to Connect with Power BI Service using PowerShell

Hi All,

 

It seems you need to change the ExecutionPolicy of PowerShell. Please refer to 

unable-to-use-appv-5-powershell-cmdlets 

azure-powershell-will-not-connect 

module/microsoft.powershell.security/set-executionpolicy?view=powershell-6

 

Please also check out if the environment is supported. 

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Dhruvin Member
Member

Re: Unable to Connect with Power BI Service using PowerShell

Still not working

JaneLHunt Frequent Visitor
Frequent Visitor

Re: Unable to Connect with Power BI Service using PowerShell

Hello

 

I was unable to connect with the Power BI Service with .Net Framework 4.7.02053 installed on my PC.  However, when .Net Framework 4.7.2 was installed from here, I found that I was then able to connect to the Power BI Service using Powershell and run the other PowerShell Management Cmdlets which call the Rest API. 

anosul Frequent Visitor
Frequent Visitor

Re: Unable to Connect with Power BI Service using PowerShell

I had the same error.

 

I cheked my PC environments based on this - Supported Environments and PowerShell Versions:

Windows PowerShell v3.0 and up with .NET 4.6.1 or above are required.

 

Then, I updated PowerShell and .NET to latest versions and restart my PC.

 

And in my case, issue has been resolved.

Dhruvin Member
Member

Re: Unable to Connect with Power BI Service using PowerShell

Thanks @JaneLHunt

 

I have upgraded ASP.Net framework to 4.7.2 and it is working fine now.

Highlighted
Vishneskij Frequent Visitor
Frequent Visitor

Re: Unable to Connect with Power BI Service using PowerShell

Just aligning this Community thread with the associated known GitHub issue.

 

Installing .NET Framework 4.7.2 solves this one.

 

https://github.com/Microsoft/powerbi-powershell/issues/41?_pjax=%23js-repo-pjax-container#issuecomme...

Manus111 Frequent Visitor
Frequent Visitor

Re: Unable to Connect with Power BI Service using PowerShell

I installed 4.7.2 from the link provided in this post and still it is giving me the same error of

 

"The term 'Login-PowerBI' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again."

 

After checking a bit futher I got .NET version 4.7.03062 (I am working in Windows 7).

 

Am I missing something as I have downloaded and installed .NET framework 4.7.2 from this link

 

Can this be a path issue. Please help me with this.