DevScope/powerbi-powershell-modules

Loading an assembly required for interactive user authentication failed

regbac opened this issue · 5 comments

Hi, I ran into a problem that you might be able to help me with. When I run the script (PowerShell ISE, stand alone or VS 2015) I get the following error : Exception calling “AcquireToken” with “4” argument(s): “Loading an assembly required for interactive user authentication
failed. Make sure assembly ‘Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms, Version=2.11.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35’ exist
Any suggestions on how to fix it, I’ve tried downloading it, installing it in the GAC but still without any success ?

Hi RegBac,
Did you download the assembly included in thegit repository?

Please try to use the module published in PowerShell Gallery you only need to run this on PowerShell ISE:

Set-ExecutionPolicy -ExecutionPolicy Unrestricted

Install-Module powerbips

Import-Module powerbips

$authToken = Get-PBIAuthToken

$authToken

Just tried it in a clean PC and worked fine.

Please confirm also that you have .Net 4.5 and that you have .net 4 in powershell_ise.exe.config:

Thanks

Hi Rui,

thanks for the quick answer.
My powershell_ise.exe.config looks like that :

I am running windows 10 and can therefore not install as is part of the
operating system (so it says when trying to install it)
Running the script you sent yields the same error :

Set-ExecutionPolicy -ExecutionPolicy Unrestricted

Install-Module powerbips

Import-Module powerbips

$authToken = Get-PBIAuthToken

$authToken
Get-PBIAuthToken : Exception calling "AcquireToken" with "4" argument(s):
"Loading an assembly required for interactive user authentication
failed. Make sure assembly
'Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms,
Version=2.11.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' exists"
At line:7 char:14

  • $authToken = Get-PBIAuthToken
  •          ~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Get-PBIAuthToken],
      MethodInvocationException
    • FullyQualifiedErrorId : AdalException,Get-PBIAuthToken

Cheers

Régis

Med venlig hilsen / Kind regards / Cordialement
Régis Baccaro

Data Platform MVP, MCT, PASS Nordic Regional Mentor
+45 26 12 50 26 <#UNIQUE_ID_SafeHtmlFilter_>
+41 79 499 79 79

@regbac https://twitter.com/regbac

http://theblobfarm.wordpress.com

On Thu, Jan 21, 2016 at 10:01 PM, Rui Romano notifications@github.com
wrote:

Hi RegBac,
Did you download the assembly included in thegit repository?

Please try to use the module published in PowerShell Gallery you only need
to run this on PowerShell ISE:

Set-ExecutionPolicy -ExecutionPolicy Unrestricted

Install-Module powerbips

Import-Module powerbips

$authToken = Get-PBIAuthToken

$authToken

Just tried it in a clean PC and worked fine.

Please confirm also that you have .Net 4.5 and that you have .net 4 in
powershell_ise.exe.config:

Thanks


Reply to this email directly or view it on GitHub
#9 (comment)
.

Hi Régis,

Noticed the repository was missing the dll "Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll", just included it.

Please try now.

PS - If you used the PowerShellGallery version (Install-Module) the dll was included and it should work.

Cheers

Hi Rui,

thank you.

That did the trick !!

Cheers

Régis

Med venlig hilsen / Kind regards / Cordialement
Régis Baccaro

Data Platform MVP, MCT, PASS Nordic Regional Mentor
+45 26 12 50 26 <#UNIQUE_ID_SafeHtmlFilter_UNIQUE_ID_SafeHtmlFilter_>
+41 79 264 84 67

@regbac https://twitter.com/regbac

http://theblobfarm.wordpress.com

On Fri, Jan 22, 2016 at 11:18 AM, Rui Romano notifications@github.com
wrote:

Hi Régis,

Noticed the repository was missing the dll
"Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll", just
included it.

Please try now.

PS - If you used the PowerShellGallery version (Install-Module) the dll
was included and it should work.

Cheers


Reply to this email directly or view it on GitHub
#9 (comment)
.

Cool.

Thanks for reporting this.

Best Regards!