AzureAD / MSAL.PS

MIT License
159 stars 29 forks source link

MSAL.PS in Azure Automation with 7.2 Runbook #65

Open Jakke2440 opened 1 year ago

Jakke2440 commented 1 year ago

I get an error when importing the module and a few more when requesting and Token

import-module MSAL.PS
--------------------------------------------------------------------------------------------
Join-Path: C:\usr\src\PSModules\MSAL.PS\internal\Import-Config.ps1:21
Line |
  21 |  … = Join-Path ([System.Environment]::GetFolderPath([System.Environment+ …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Cannot bind argument to parameter 'Path' because it is an empty string.

Join-Path: C:\usr\src\PSModules\MSAL.PS\internal\Import-Config.ps1:22
Line |
  22 |          $Path = Join-Path $AppDataDirectory $Path
     |                            ~~~~~~~~~~~~~~~~~
     | Cannot bind argument to parameter 'Path' because it is null.
--------------------------------------------------------------------------------------------
Get-Msaltoken -ClientId $clientId -tenantid $tenantID -UserCredential $Cred

--->> I need to use usercredential because I want to assign an Label to a Group
--------------------------------------------------------------------------------------------
New-MsalClientApplication: C:\usr\src\PSModules\MSAL.PS\Select-MsalClientApplication.ps1:56
Line |
  56 |  … plication = New-MsalClientApplication -ErrorAction Stop @paramNewMsal …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Exception calling "Build" with "0" argument(s): "Error: ClientId is not a GUID. "

PropertyNotFoundException: C:\usr\src\PSModules\MSAL.PS\Select-MsalClientApplication.ps1:88
Line |
  88 |          Write-Debug ('Adding Application with ClientId [{0}] and Redi …
     |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | The property 'AppConfig' cannot be found on this object. Verify that the property exists.

Add-MsalClientApplication: C:\usr\src\PSModules\MSAL.PS\Select-MsalClientApplication.ps1:89
Line |
  89 |          Add-MsalClientApplication $ClientApplication
     |                                    ~~~~~~~~~~~~~~~~~~
     | Cannot bind argument to parameter 'PublicClientApplication' because it is null.

InvalidOperation: C:\usr\src\PSModules\MSAL.PS\Get-MsalToken.ps1:252
Line |
 252 |  …             $AquireTokenParameters = $PublicClientApplication.Acquire …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | You cannot call a method on a null-valued expression.

InvalidOperation: C:\usr\src\PSModules\MSAL.PS\Get-MsalToken.ps1:338
Line |
 338 |  …            elseif ($TenantId) { [void] $AquireTokenParameters.WithAut …
     |                                           ~~~~~~~~~~~~~~~~~~~~~~
     | The variable '$AquireTokenParameters' cannot be retrieved because it has not been set.

PropertyNotFoundException: C:\usr\src\PSModules\MSAL.PS\Get-MsalToken.ps1:343
Line |
 343 |  …             Write-Debug ('Aquiring Token for Application with ClientI …
     |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | The property 'ClientId' cannot be found on this object. Verify that the property exists.

InvalidOperation: C:\usr\src\PSModules\MSAL.PS\Get-MsalToken.ps1:385
Line |
 385 |  … lureAuthenticationError' -TargetObject $AquireTokenParameters -ErrorA …
     |                                           ~~~~~~~~~~~~~~~~~~~~~~
     | The variable '$AquireTokenParameters' cannot be retrieved because it has not been set.
--------------------------------------------------------------------------------------------