Open

Description
Description
When importing Az.Accounts on Linux, the startup checks assume that $HOME is set to a non-empty string. Some CI servers (TeamCity at least) do not set this by default.
The error is thrown in
Maybe it would be better to check whether $HOME is set before calling Join-Path there, and either skip the check or produce a meaningful error message.
Issue script & Debug output
Set-Variable -Name Home -Value "" -Force
Import-Module Az.Accounts
Join-Path: {REDACTED}/.local/share/powershell/Modules/Az.Accounts/2.19.0/StartupScripts/AzError.ps1:32
Line |
32 | $pathToInstallationChecks = Join-Path (Join-Path $HOME ".Azure") …
| ~~~~~
| Cannot bind argument to parameter 'Path' because it is an empty string.
InvalidOperation: {REDACTED}/.local/share/powershell/Modules/Az.Accounts/2.19.0/StartupScripts/AzError.ps1:34
Line |
34 | if (!(Test-Path $pathToInstallationChecks -ErrorAction Ignore))
| ~~~~~~~~~~~~~~~~~~~~~~~~~
| The variable '$pathToInstallationChecks' cannot be retrieved because it has not been
| set.
Environment data
Name Value
---- -----
PSVersion 7.4.1
PSEdition Core
GitCommitId 7.4.1
OS Ubuntu 22.04.4 LTS
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Module versions
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.19.0 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-AzDefault…}
Error output
No response