Azure / azure-powershell

Microsoft Azure PowerShell
Other
4.26k stars 3.86k forks source link

Setting AZURE_CLIENTS_SHOW_SECRETS_WARNING env var doesn't disable secrets warning #25001

Open peterboba opened 5 months ago

peterboba commented 5 months ago

Description

According to https://learn.microsoft.com/en-us/powershell/azure/protect-secrets?view=azps-12.0.0#disable-the-warning-message setting env var AZURE_CLIENTS_SHOW_SECRETS_WARNING should disable secrets warning. This doesn't seem to work unless user uses Connect-AzAccount.

I'd expect this to work without the need to relog.

Issue script & Debug output

Get-AzEventHubKey ...
...
WARNING: The output of cmdlet Get-AzEventHubKey may compromise security by showing the following secrets:
PrimaryConnectionString, PrimaryKey, SecondaryConnectionString, SecondaryKey. Learn more at
https://go.microsoft.com/fwlink/?linkid=2258844
Set-Item -Path Env:\AZURE_CLIENTS_SHOW_SECRETS_WARNING -Value $false
Get-AzEventHubKey ...
...
WARNING: The output of cmdlet Get-AzEventHubKey may compromise security by showing the following secrets:
PrimaryConnectionString, PrimaryKey, SecondaryConnectionString, SecondaryKey. Learn more at
https://go.microsoft.com/fwlink/?linkid=2258844

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.19041.4412
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.4412
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Module versions

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     3.0.0      Az.Accounts                         {Add-AzEnvironment, Clear-AzConfig, Clear-AzContext, Clear...
Script     5.0.0      Az.EventHub

Error output

No response

peterboba commented 5 months ago

Also, I have additional question - how is this implemented? I get a secret warning on one event hub resource, but I don't get this on another. The request is using the same API version.