New-AzResourceGroup
Creates a resource group to contain other Azure resources.
SYNOPSIS
Creates a resource group.
SYNTAX
New-AzResourceGroup -Name <String> [-Location <String>] [-Force] [-Tag <Hashtable>] [-DefaultProfile <IAzureContextContainer>] []
DESCRIPTION
The New-AzResourceGroup cmdlet creates a resource group in your Azure subscription. A resource group is a logical container that holds related resources for an Azure solution.
You can specify the name and location for the resource group. You can also use the -Tag parameter to assign tags to the resource group.
PARAMETERS
-
-Name
Specifies the name of the new resource group.
Required.
-
-Location
Specifies the Azure region for the resource group.
Optional.
Example values: "East US", "West Europe", "Southeast Asia".
-
-Force
Suppresses confirmation messages. If a resource group with the same name already exists, this parameter forces the operation to continue without prompting for confirmation.
Optional.
-
-Tag
Specifies tags as a hash table that this cmdlet assigns to the resource group. Tags are name-value pairs that help categorize resources.
Optional.
Example: @{"Environment"="Development"; "Project"="ContosoApp"}
-
-DefaultProfile
The credentials, account, tenant, and subscription that are used for communication with Azure.
Optional.
-
[<CommonParameters>]
This cmdlet supports common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, OutVariable, PipelineVariable, and For. To get the list of parameters, type:
Get-Help about_CommonParameters.
Optional.
EXAMPLE USAGE
Create a resource group with a name and location
New-AzResourceGroup -Name "MyResourceGroup" -Location "East US"
Create a resource group with a name, location, and tags
New-AzResourceGroup -Name "MyWebAppRG" -Location "West Europe" -Tag @{"Environment"="Production"; "Application"="ContosoWeb"}
Create a resource group, overwriting if it already exists
New-AzResourceGroup -Name "MyResourceGroup" -Location "East US" -Force
INPUTS
None. You can pipe to this cmdlet.
OUTPUTS
Microsoft.Azure.Commands.ResourceManager.Cmdlets.SdkModels.PSResourceGroup
NOTES
Resource groups are a fundamental concept in Azure for managing resources. They allow you to group related resources and manage them as a single unit for tasks like deployment, monitoring, and access control.
RELATED LINKS
Get-AzResourceGroup
Remove-AzResourceGroup
Set-AzResourceGroup