Update-AzConfig

Updates the configs of Azure PowerShell.

Syntax

Update-AzConfig
      [-AppliesTo <String>]
      [-Scope <ConfigScope>]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [-DefaultSubscriptionForLogin <String>]
      [-DisplayBreakingChangeWarning <Boolean>]
      [-DisplaySurveyMessage <Boolean>]
      [-EnableDataCollection <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.

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".
Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

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

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-DefaultSubscriptionForLogin

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

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False

-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.

Type:Boolean
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False

-DisplaySurveyMessage

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

Type:Boolean
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False

-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

Type:Boolean
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False

-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

Type:Boolean
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False

-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.

Type:ConfigScope
Accepted values:CurrentUser, Process, Default, Environment
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

String

Boolean

Outputs

PSConfig