Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

PowerShell Login to Power BI - Write Error

Hi All,

I'm attempting to login to Power BI through the PowerShell Power BI cmdlet.. I was able to install the cmdlet (Install-Module -Name MicrosoftPowerBIMgmt) however when trying to login I recieve a WriteError (shown below).. When using "Connect-PowerBIServiceAccount" or "Login-PowerBI" the login screen for my organization comes up and I login using my credentials.. Howver then PowerShell returns the WriteError.

Since the image is kinda hard to read here is the error:
Login-PowerBIServiceAccount : One or more errors occurred.
At line:1 char:1
+ Login-PowerBIServiceAccount
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (Microsoft.Power...IServiceAccount:ConnectPowerBIServiceAccount) [Connect-PowerBIServiceAccount], AggregateException
    + FullyQualifiedErrorId : One or more errors occurred.,Microsoft.PowerBI.Commands.Profile.ConnectPowerBIServiceAccount

--

It seems most of the WriteErrors in similar posts occured in steps subsequent to logging in. 

I do have a Pro license and Premium capacity available if that's also relevant. I'm attempting to return the access token for Power BI Embedded using PowerShell as described here.

 

I'm a PowerShell novice so I appreicate any guidance.

Thanks!

  • Hi there

    I would suggest you install ALL the Power BI Modules. And can you confirm the version you have installed is 1.0.830?

    They are:
    MicrosoftPowerBIMgmt.Admin
    MicrosoftPowerBIMgmt.Capacities
    MicrosoftPowerBIMgmt.Data
    MicrosoftPowerBIMgmt.Profile
    MicrosoftPowerBIMgmt.Reports
    MicrosoftPowerBIMgmt.Workspaces

5 Replies

  • Hi there

    I would suggest you install ALL the Power BI Modules. And can you confirm the version you have installed is 1.0.830?

    They are:
    MicrosoftPowerBIMgmt.Admin
    MicrosoftPowerBIMgmt.Capacities
    MicrosoftPowerBIMgmt.Data
    MicrosoftPowerBIMgmt.Profile
    MicrosoftPowerBIMgmt.Reports
    MicrosoftPowerBIMgmt.Workspaces
    • Anonymous's avatar
      Anonymous
      Not applicable

      That seemed to work! I was able to retrieve the embed token.

      I did run into a snag when then trying that embed token in the Microsoft Power BI Embedded Playground for whatever the reason when trying to run using one of my own reports it wouldn't render at all in the embed view in the lower part of the page.

      The steps being:

      -Switch to AAD token
      -Paste embed token from PowerShell
      -Paste Embed URL (from report)
      -Past Report ID
      -Hit Run

      From there no results, not even anything showing up on the log on the right of that screen.

      Does the report need to be registered in Azure as an app first? Which I also tried and didn't have anymore luck. 

      • GilbertQ's avatar
        GilbertQ
        Super User
        Hi there

        Yes you would have to create an App with the permissions to Power BI in Azure Active Directory.
    • deepakbhatta07's avatar
      deepakbhatta07
      Regular Visitor

      Hi Team,

       

      Can you advise if "Connect - Power BI account" cmdlet while used with service principal will still ask for MFA prompt ? We are trying to setup a mechanism where we want to keep MFA enabled for org security, but figure a way to automate fetching Power BI logs through this account. Please let me know how can this be setup.

  • Icey's avatar
    Icey
    Community Support

    Hi Anonymous ,

     

    I can't reproduce your issue.

     

    1. Please check.

    Supported environments and PowerShell versions:

    • 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.

     

    2. Install Profile module for Power BI Cmdlets.

    Install-Module -Name MicrosoftPowerBIMgmt.Profile

     

    3. Run as Administrator and try to login to Power BI.

     

     

    Best Regards,

    Icey

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.