Installing the Az module from the PowerShell Gallery will install the base Az module, as well as all other submodules (_e.g._, Az.Compute, Az.Sql, etc.) that it requires -- however, this module appears to be skipped when running Get-Module -ListAvailable, whereas all of the submodules appear.
> Install-Module -Name Az -Repository PSGallery -Force
> Get-Module -Name Az -ListAvailable
> Get-Module -Name Az -ListAvailable
Directory: C:\Program Files\PowerShell\Modules
ModuleType Version Name PSEdition ExportedCommands
---------- ------- ---- --------- ----------------
Script 0.4.0 Az Core,Desk
>
> Get-Module -Name Az -ListAvailable
>
> $PSVersionTable
Name Value
---- -----
PSVersion 6.1.0
PSEdition Core
GitCommitId 6.1.0
OS Microsoft Windows 10.0.17763
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
@rjmholt for comment.
Looked into the code, and this is because Az is a valid culture and powershell believes its a local directory just like en and skipped it ...
c#
LCID Name DisplayName
---- ---- -----------
44 az Azerbaijani
https://github.com/PowerShell/PowerShell/blob/ddaad12183112d6fd28bedadff7761c630e71d5b/src/System.Management.Automation/engine/Modules/ModuleUtils.cs#L46-L59
Wow, what's the situation this is intended to avoid? Is there an extra check we can do, like check if the dirname matches the module name?
@rjmholt looks like an optimization with the assumption that directories named after locales don't contain modules. Perhaps we can just remove that bit of code and see what the perf difference is.
Most helpful comment
Looked into the code, and this is because
Azis a valid culture and powershell believes its a local directory just likeenand skipped it ...c# LCID Name DisplayName ---- ---- ----------- 44 az Azerbaijanihttps://github.com/PowerShell/PowerShell/blob/ddaad12183112d6fd28bedadff7761c630e71d5b/src/System.Management.Automation/engine/Modules/ModuleUtils.cs#L46-L59