Open ikiris04 opened 1 year ago
I believe the following needs to be modified in import-config.ps1 1) passing a DoNotVerify option to getfolderpath 2) Create the directory if needed
$AppDataDirectory = Join-Path ([System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::ApplicationData,[System.Environment+SpecialFolderOption]::DoNotVerify)) 'MSAL.PS'
$Path = Join-Path $AppDataDirectory $Path
[chrischua@X-p1vnc0 PIM]$ pwsh PowerShell 7.3.1 PS /users/chrischua@chevron.com/GIT/ops-scripts/PIM> $psversiontable
Name Value
PSVersion 7.3.1 PSEdition Core GitCommitId 7.3.1 OS Linux 4.18.0-372.32.1.el8_6.x86_64 #1 SMP Fri Oct 7 12:35:10 EDT 2022 Platform Unix PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0
PS /users/chrischua> get-module -listavailable MSAL.PS
ModuleType Version PreRelease Name PSEdition ExportedCommands
Script 4.37.0.0 MSAL.PS Core,Desk {Add-MsalClientApplication, Clear-MsalTokenCache, Enable-MsalTokenCacheOnDisk, Get-MsalAccount…}
PS /users/chrischua> $debugPreference='Continue' PS /users/chrischua> import-module MSAL.PS Join-Path: /usr/local/share/powershell/Modules/MSAL.PS/4.37.0.0/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: /usr/local/share/powershell/Modules/MSAL.PS/4.37.0.0/internal/Import-Config.ps1:22 Line | 22 | $Path = Join-Path $AppDataDirectory $Path |~~~~~ | Cannot bind argument to parameter 'Path' because it is null.The command returns null because [System.Environment+SpecialFolder]::ApplicationData) is mapping to home/.config and if home/.config doesn't exist, it returns null https://developers.redhat.com/blog/2018/11/07/dotnet-special-folder-api-linux#environment_getfolderpath