-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Description
Seems like all modules have a *.Autorest*.psm1 file (where * is sub module name) that contains the following code:
Write-Information "Loaded Module '$($accountsModule.Name)'"
For us that use the information stream for logging we get unwanted pollution of the info stream from these messages, and makes us have to use -InformationVariable infoVar on almost everything to be able to scrub the stream output:
Write-Information -MessageData "$($infoVar| Out-String -Stream | Select-String -Pattern "Loaded Module" -NotMatch)"
We use alot of ForEeach-Object -Parallel with calls to Az inside, and as this loads Az modules for each, there is a lot of pollution of the information stream from the use of Write-Information for the module load message in Az.
Please instead use, as this is often by default silenced with $VerbosePreference = "SilentlyContinue":
Write-Verbose -Message "Loaded Module '$($accountsModule.Name)'"
This is especially anoying in Azure DevOps, where the AzurePowershell task uses $InformationPreference = "Continue"
The most problematic is Az.Resources as we use this all over the place.
Issue script & Debug output
No outputEnvironment data
PS C:\eunomia> $PSVersionTable
Name Value
---- -----
PSVersion 7.4.2
PSEdition Core
GitCommitId 7.4.2
OS Microsoft Windows 10.0.22635
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Module versions
PS C:\eunomia> Get-Module Az* | Format-Table -AutoSize
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Script 2.17.0 Az.Accounts {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear-A…
Script 7.4.1 Az.Network {Add-AzApplicationGatewayAuthenticationCertificate, Add-AzAp…
Script 6.16.1 Az.Resources {Export-AzResourceGroup, Export-AzTemplateSpec, Get-AzDenyAs…Error output
No error output, but information stream when importing Az.Resources:
Loaded Module 'Az.Accounts'
Loaded Module 'Az.Authorization'
Loaded Module 'Az.Accounts'
Loaded Module 'Az.MSGraph'