Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

Update-AzConfig

Updates the configs of Azure PowerShell.

Syntax

Default (Default)

Update-AzConfig
 [-AppliesTo <String>]
 [-Scope <ConfigScope>]
 [-DefaultProfile <IAzureContextContainer>]
 [-WhatIf]
 [-Confirm]
 [-CheckForUpgrade <Boolean>]
 [-DefaultSubscriptionForLogin <String>]
 [-DisableInstanceDiscovery <Boolean>]
 [-DisplayBreakingChangeWarning <Boolean>]
 [-DisplayRegionIdentified <Boolean>]
 [-DisplaySecretsWarning <Boolean>]
 [-DisplaySurveyMessage <Boolean>]
 [-EnableDataCollection <Boolean>]
 [-EnableErrorRecordsPersistence <Boolean>]
 [-EnableLoginByWam <Boolean>]
 [<CommonParameters>]

Description

Updates the configs of Azure PowerShell. Depending on which config to update, you may specify the scope where the config is persisted and to which module or cmdlet it applies to.

Note

It is discouraged to update configs in multiple PowerShell processes. Either do it in one process, or make sure the updates are at Process scope (-Scope Process) to avoid unexpected side-effects.

Examples

Example 1

Update-AzConfig -DefaultSubscriptionForLogin "Name of subscription"
Key Value Applies To Scope Help Message
--- ----- ---------- ----- ------------
DefaultSubscriptionForLogin Name of subscription Az CurrentUser Subscription name or GUID. Sets the default context for Azure PowerShell when lo…

Sets the "DefaultSubscriptionForLogin" config as "Name of subscription". When Connect-AzAccount the specified subscription will be selected as the default subscription.

Example 2

Update-AzConfig -DisplayBreakingChangeWarning $false -AppliesTo "Az.KeyVault"
Key Value Applies To Scope Help Message
--- ----- ---------- ----- ------------
DisplayBreakingChangeWarning False Az.KeyVault CurrentUser Controls if warning messages for breaking changes are displayed or suppressed. When enabled,…

Sets the "DisplayBreakingChangeWarnings" config as "$false" for "Az.KeyVault" module. This prevents all the warning messages for upcoming breaking changes in Az.KeyVault module from prompting.

Example 3

Update-AzConfig -EnableDataCollection $true
Key Value Applies To Scope Help Message
--- ----- ---------- ----- ------------
EnableDataCollection True Az CurrentUser When enabled, Azure PowerShell cmdlets send telemetry data to Microsoft to improve the customer experi…

Sets the "EnableDataCollection" config as "$true". This enables sending the telemetry data. Setting this config is equivalent to Enable-AzDataCollection and Disable-AzDataCollection.

Example 4

Update-AzConfig -DisplaySecretsWarning $true
Key Value Applies To Scope Help Message
--- ----- ---------- ----- ------------
DisplaySecretsWarning True Az CurrentUser When enabled, a warning message for secrets redaction will be displ…

Sets the "DisplaySecretsWarning" config as "$true". This enables the secrets detection during the cmdlet execution and displays a warning message if any secrets are found in the output.

Parameters

-AppliesTo

Specifies what part of Azure PowerShell the config applies to. Possible values are:

  • "Az": the config applies to all modules and cmdlets of Azure PowerShell.
  • Module name: the config applies to a certain module of Azure PowerShell. For example, "Az.Storage".
  • Cmdlet name: the config applies to a certain cmdlet of Azure PowerShell. For example, "Get-AzKeyVault". If not specified, when getting or clearing configs, it defaults to all the above; when updating, it defaults to "Az".

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-CheckForUpgrade

When enabled, Azure PowerShell will check for updates automatically and display a hint message when an update is available. The default value is true.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

-DefaultSubscriptionForLogin

Subscription name or GUID. Sets the default context for Azure PowerShell when logging in without specifying a subscription.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-DisableInstanceDiscovery

Set it to true to disable both instance discovery and authority validation. This functionality is intended for use in scenarios where the metadata endpoint cannot be reached, such as in private clouds or Azure Stack. The process of instance discovery entails retrieving authority metadata from https://login.microsoft.com/ to validate the authority. By setting this to true, the validation of the authority is disabled. As a result, it is crucial to ensure that the configured authority host is valid and trustworthy.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-DisplayBreakingChangeWarning

Controls if warning messages for breaking changes are displayed or suppressed. When enabled, a breaking change warning is displayed when executing cmdlets with breaking changes in a future release.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-DisplayRegionIdentified

When enabled, Azure PowerShell displays recommendations on regions which may reduce your costs.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-DisplaySecretsWarning

When enabled, a warning message will be displayed when the cmdlet output contains secrets. Learn more at https://go.microsoft.com/fwlink/?linkid=2258844

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-DisplaySurveyMessage

When enabled, you are prompted infrequently to participate in user experience surveys for Azure PowerShell.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-EnableDataCollection

When enabled, Azure PowerShell cmdlets send telemetry data to Microsoft to improve the customer experience. For more information, see our privacy statement: https://aka.ms/privacy

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-EnableErrorRecordsPersistence

When enabled, error records will be written to ~/.Azure/ErrorRecords.

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-EnableLoginByWam

[Preview] When enabled, Web Account Manager (WAM) will be the default interactive login experience. It will fall back to using the browser if the platform does not support WAM. Note that this feature is under preview. Microsoft Account (MSA) is currently not supported. Feel free to reach out to Azure PowerShell team if you have any feedbacks: https://aka.ms/azpsissue

Parameter properties

Type:Boolean
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-LoginExperienceV2

Only active when authenticating interactively, allows the user to choose the subscription and tenant used in subsequent commands. Possible values ad 'On' (Default) and 'Off'. 'On' requires user's input. 'Off' will use the first tenant and subscription returned by Azure, can change without notice and lead to command execution in an unwanted context (not recommended).

Parameter properties

Type:LoginExperienceConfig
Default value:None
Accepted values:On, Off
Supports wildcards:False
DontShow:False

Parameter sets

-Scope

Determines the scope of config changes, for example, whether changes apply only to the current process, or to all sessions started by this user. By default it is CurrentUser.

Parameter properties

Type:ConfigScope
Default value:None
Accepted values:CurrentUser, Process, Default, Environment
Supports wildcards:False
DontShow:False

Parameter sets

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

Boolean

String

Outputs

PSConfig


Feedback

Was this page helpful?