Hey,
I try to work with Azure AD.
# Change to correct file location Add-Type -Path "D:\GraphAPI\Microsoft.IdentityModel.Clients.ActiveDirectory.3.10.305161347\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.dll" # Change these three values to your application and tenant settings $clientID = "# CLIENT ID for application” $clientSecret = " # KEY for application” $tenant = " # The tenant domain name” $resAzureGraphAPI = "https://graph.windows.net"; $serviceRootURL = "https://graph.windows.net/$tenant" $authString = "https://login.windows.net/$tenant"; [Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext]$AuthContext = [Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext]$authString [Microsoft.IdentityModel.Clients.ActiveDirectory.ClientCredential]$clientCredential = New-Object -TypeName "Microsoft.IdentityModel.Clients.ActiveDirectory.ClientCredential"($clientID, $clientSecret) # Requests a bearer token $authenticationResult = $AuthContext.AcquireToken($resAzureGraphAPI, $clientCredential);
Here I get the error: Method invocation failed because [Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContex] does not contain a method named ‘AcquireToken’.
What can I do to solve this error?
Thanks for your help
Stefan