How to configure Azure PowerShell global settings with the *-AzConfig cmdlets

This article is a brief introduction designed to raise awareness about the *-AzConfig cmdlets in Azure PowerShell. These cmdlets, introduced in the Az PowerShell module version 9, are used to configure your global settings for Azure PowerShell.

For the official Microsoft documentation, see Configure Azure PowerShell global settings.

Getting started

For the best and most feature-rich experience, always use the latest version of Azure PowerShell.

Install the latest version of the Az PowerShell module:

1Install-Module -Name Az -Repository PSGallery -Force

Configure global settings

Get-AzConfig

The Get-AzConfig cmdlet retrieves your current global settings for Azure PowerShell. This can be useful for checking your existing configuration or verifying changes.

Determine the available global configuration options and their current values:

1Get-AzConfig

You can also specify parameters to filter the results. For example, to see only the current settings for breaking change warning messages, use the DisplayBreakingChangeWarning parameter:

1Get-AzConfig -DisplayBreakingChangeWarning

As with any PowerShell cmdlet, use Get-Help to learn more about its usage:

1help Get-AzConfig

Update-AzConfig

The Update-AzConfig cmdlet allows you to change your Azure PowerShell global settings. For example, you can turn off breaking change warning messages with the following command:

1Update-AzConfig -DisplayBreakingChangeWarning $false

You can also limit the changes to a specific module. For example, to turn off breaking change warning messages for the Az.Compute module, use the AppliesTo parameter:

1Update-AzConfig -DisplayBreakingChangeWarning $false -AppliesTo Az.Compute

Clear-AzConfig

The Clear-AzConfig cmdlet resets Azure PowerShell global settings to their default values.

Reset whether to display breaking change warning messages to its default behavior:

1Clear-AzConfig -DisplayBreakingChangeWarning

Export-AzConfig

The Export-AzConfig cmdlet exports your current Azure PowerShell global settings to a JSON file.

1Export-AzConfig -Path $HOME\AzConfig.json

Import-AzConfig

The Import-AzConfig cmdlet imports Azure PowerShell global settings from a JSON file.

1Import-AzConfig -Path $HOME\AzConfig.json

Conclusion

The *-AzConfig cmdlets in Azure PowerShell provide a powerful way to manage your global settings. Using these cmdlets, you can customize your Azure PowerShell environment to match your requirements and preferences.

References