Azure-PowerShell-Snippets icon indicating copy to clipboard operation
Azure-PowerShell-Snippets copied to clipboard

AAD DLL provided is wrong version

Open DianeHadley opened this issue 5 years ago • 3 comments

The updated script in AADTool (Common.ps1) relies on a newer version of the AAD dll than that which is provided. Running script with old version leads to the following error: New-Object : Cannot find type [Microsoft.IdentityModel.Clients.ActiveDirectory.PlatformParameters]: verify that the assembly containing this type is loaded.

DianeHadley avatar Apr 09 '19 20:04 DianeHadley

Same issue here!

Replacing the "Microsoft.IdentityModel.Clients.ActiveDirectory.dll" from the latest source below worked. https://www.nuget.org/packages/Microsoft.IdentityModel.Clients.ActiveDirectory/

serkanozkul avatar May 07 '19 10:05 serkanozkul

Same issue here!

Replacing the "Microsoft.IdentityModel.Clients.ActiveDirectory.dll" from the latest source below worked. https://www.nuget.org/packages/Microsoft.IdentityModel.Clients.ActiveDirectory/

Then what change did you make in Common.ps1 to run it again successfully? Also which version of the dll did you use?

bnlprsd avatar Jun 05 '19 12:06 bnlprsd

Tried the latest source from https://www.nuget.org/packages/Microsoft.IdentityModel.Clients.ActiveDirectory/

but still not working

Cannot find an overload for "AcquireTokenAsync" and the argument count: "4". At C:\Users\shz\Desktop\Azure-PowerShell-Snippets-master\Azure-PowerShell-Snippets-master\MicrosoftAzureServiceFabric-AADHelpers\AADTool\Common.ps1:36 char:5

  • $accessToken = $authenticationContext.AcquireTokenAsync($resource ...
    
  • ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodException
    • FullyQualifiedErrorId : MethodCountCouldNotFindBest

Invoke-RestMethod : {"odata.error":{"code":"Authentication_MissingOrMalformed","message":{"lang":"en","value":"Access Token missing or malformed."}}} At C:\Users\shz\Desktop\Azure-PowerShell-Snippets-master\Azure-PowerShell-Snippets-master\MicrosoftAzureServiceFabric-AADHelpers\AADTool\Common.ps1:46 char:13

  • return (Invoke-RestMethod $uri -Method $method -Headers $headers  ...
    
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
    • FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

harryzsh avatar Sep 10 '19 11:09 harryzsh