Set-AzDefault

In this Azure PowerShell article, we will discuss the syntax and usage of the Set-AzDefault Azure PowerShell command with examples of how to use the Set-AzDefault PowerShell command.

Set-AzDefault

This is a very good PowerShell command that can help you to add or edit or set a default to your current Azure Context.

Syntax

Below is the syntax of the Set-AzDefault PowerShell command.

Set-AzDefault
  [-ResourceGroupName <String>]

Well, let’s discuss an example of how to use the Set-AzDefault PowerShell command with an example.

Example

You can execute the below Azure PowerShell command that can set the MyrsgGroup as the default Resource Group for you.

Set-AzDefault -ResourceGroupName newresgroup

After executing the above Azure PowerShell command, I got the below output.

PS C:\WINDOWS\system32> Set-AzDefault -ResourceGroupName newresgroup


Id         : /subscriptions/1cdf4300-dee5-4518-8c8c-feaa72a5ckl1/resourceGroups/newres
             group
Name       : newresgroup
Properties : Microsoft.Azure.Management.Internal.Resources.Models.ResourceGroupPropert
             ies
Location   : centralus
ManagedBy  : 
Tags       : 

You can see the same output below

Set-AzDefault

Set-AzDefault – Video Tutorial

You can use the Clear-AzDefault PowerShell command to clear the default set by the user.

You may also like following the articles below

Wrapping Up

In this Azure PowerShell article, we discussed the syntax and usage of the Set-AzDefault PowerShell command with an example. Thanks for showing interest in reading this article !!!