< Back

New-AzureRmResourceGroup

Tue Jan 29, 2019 10:05 pm

NAME New-AzureRmResourceGroup



SYNOPSIS

Creates an Azure resource group.





SYNTAX

New-AzureRmResourceGroup [-ApiVersion <String>] [-DefaultProfile <IAzureContextContainer>] [-Force] -Location <String> -Name <String> [-Pre] [-Tag

<Hashtable>] [-Confirm] [-WhatIf] [<CommonParameters>]





DESCRIPTION

The New-AzureRmResourceGroup cmdlet creates an Azure resource group.



You can create a resource group by using just a name and location, and then use the New-AzureRmResource cmdlet to create resources to add to the

resource group.



To add a deployment to an existing resource group, use the New-AzureRmResourceGroupDeployment cmdlet. To add a resource to an existing resource

group, use the New-AzureRmResource cmdlet. An Azure resource is a user-managed Azure entity, such as a database server, database, or website. An

Azure resource group is a collection of Azure resources that are deployed as a unit.





PARAMETERS

-ApiVersion <String>

Specifies the API version that is supported by the resource Provider. You can specify a different version than the default version.



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

The credentials, account, tenant, and subscription used for communication with azure



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-Force [<SwitchParameter>]

Forces the command to run without asking for user confirmation.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Location <String>

Specifies the location of the resource group. Specify an Azure data center location, such as West US or Southeast Asia. You can place a

resource group in any location. The resource group does not have to be in the same location your Azure subscription or in the same location as

its resources.



To determine which location supports each resource type, use the Get-AzureRmResourceProvider cmdlet with the ProviderNamespace parameter.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Name <String>

Specifies a name for the resource group. The resource name must be unique in the subscription. If a resource group that has that name already

exists, the command prompts you for confirmation before replacing the existing resource group.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Pre [<SwitchParameter>]

Indicates that this cmdlet considers pre-release API versions when it automatically determines which version to use.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-Tag <Hashtable>

Key-value pairs in the form of a hash table. For example:



@{key0="value0";key1=$null;key2="value2"}



To add or change a tag, you must replace the collection of tags for the resource group.



After you assign tags to resources and groups, you can use the Tag parameter of Get-AzureRmResource and Get-AzureRmResourceGroup to search for

resources and groups by tag name or by name and value. You can use tags to categorize your resources, such as by department or cost center, or

to track notes or comments about the resources.



To get your predefined tags, use the Get-AzureRMTag cmdlet.



Required? false

Position? named

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

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



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

None







OUTPUTS

Microsoft.Azure.Commands.ResourceManagement.Models.PSResourceGroup







NOTES









Example 1: Create an empty resource group



PS> New-AzureRmResourceGroup -Name RG01 -Location "South Central US"



This command creates a resource group that has no resources. You can use the New-AzureRmResource or New-AzureRmResourceGroupDeployment cmdlets to

add resources and deployments to this resource group.





Example 2: Create an empty resource group using positional parameters



PS> New-AzureRmResourceGroup RG01 "South Central US"



This command creates a resource group that has no resources.





Example 3: Create a resource group with tags



PS> New-AzureRmResourceGroup -Name RG01 -Location "South Central US" -Tag @{Empty=$null; Department="Marketing"}



This command creates an empty resource group. This command is the same as the command in Example 1, except that it assigns tags to the resource

group. The first tag, named Empty, can be used to identify resource groups that have no resources. The second tag is named Department and has a

value of Marketing. You can use a tag such as this one to categorize resource groups for administration or budgeting.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... ourcegroup

Get-AzureRmResourceProvider

Get-AzureRmResourceGroup

New-AzureRmResource

New-AzureRmResourceGroupDeployment

Remove-AzureRmResourceGroup

Set-AzureRmResourceGroup