Share via


New-AzureResourceGroupDeployment

New-AzureResourceGroupDeployment

Adds an Azure deployment to a resource group.

Syntax

Parameter Set: Default
New-AzureResourceGroupDeployment -ResourceGroupName <String> [-Name <String> ] [-Profile <AzureProfile> ] [-TemplateVersion <String> ] [ <CommonParameters>]

Parameter Set: Deployment via Gallery and template parameters file
New-AzureResourceGroupDeployment -GalleryTemplateIdentity <String> -ResourceGroupName <String> -TemplateParameterFile <String> [-Name <String> ] [-Profile <AzureProfile> ] [-TemplateVersion <String> ] [ <CommonParameters>]

Parameter Set: Deployment via Gallery and template parameters object
New-AzureResourceGroupDeployment -GalleryTemplateIdentity <String> -ResourceGroupName <String> -TemplateParameterObject <Hashtable> [-Name <String> ] [-Profile <AzureProfile> ] [-TemplateVersion <String> ] [ <CommonParameters>]

Parameter Set: Deployment via Gallery without parameters
New-AzureResourceGroupDeployment -GalleryTemplateIdentity <String> -ResourceGroupName <String> [-Name <String> ] [-Profile <AzureProfile> ] [-TemplateVersion <String> ] [ <CommonParameters>]

Parameter Set: Deployment via template file and template parameters file
New-AzureResourceGroupDeployment -ResourceGroupName <String> -TemplateFile <String> -TemplateParameterFile <String> [-Name <String> ] [-Profile <AzureProfile> ] [-StorageAccountName <String> ] [-TemplateVersion <String> ] [ <CommonParameters>]

Parameter Set: Deployment via template file and template parameters object
New-AzureResourceGroupDeployment -ResourceGroupName <String> -TemplateFile <String> -TemplateParameterObject <Hashtable> [-Name <String> ] [-Profile <AzureProfile> ] [-StorageAccountName <String> ] [-TemplateVersion <String> ] [ <CommonParameters>]

Parameter Set: Deployment via template file without parameters
New-AzureResourceGroupDeployment -ResourceGroupName <String> -TemplateFile <String> [-Name <String> ] [-Profile <AzureProfile> ] [-StorageAccountName <String> ] [-TemplateVersion <String> ] [ <CommonParameters>]

Parameter Set: Deployment via template uri and template parameters file
New-AzureResourceGroupDeployment -ResourceGroupName <String> -TemplateParameterFile <String> -TemplateUri <String> [-Name <String> ] [-Profile <AzureProfile> ] [-TemplateVersion <String> ] [ <CommonParameters>]

Parameter Set: Deployment via template uri and template parameters object
New-AzureResourceGroupDeployment -ResourceGroupName <String> -TemplateParameterObject <Hashtable> -TemplateUri <String> [-Name <String> ] [-Profile <AzureProfile> ] [-TemplateVersion <String> ] [ <CommonParameters>]

Parameter Set: Deployment via template uri without parameters
New-AzureResourceGroupDeployment -ResourceGroupName <String> -TemplateUri <String> [-Name <String> ] [-Profile <AzureProfile> ] [-TemplateVersion <String> ] [ <CommonParameters>]

Detailed Description

The New-AzureResourceGroupDeployment cmdlet adds an Azure deployment to an existing resource group. This cmdlet also adds the resources that the deployment requires. To add resources to a resource group without using a template, use the New-AzureResource cmdlet.

For more information about Azure resources and Azure resource groups, see the New-AzureResourceGroup cmdlet.

A deployment uses a resource group template to add resources to a resource group, and publish the resources so that they are available in Azure.

To add a resource group deployment, specify the name of an existing resource group and a resource group template. A template is a model of a resource group in JavaScript Object Notation (JSON). For more information about Azure resource group templates, see the New-AzureResourceGroup cmdlet.

To use a gallery template, specify the GalleryTemplateIdentity parameter. You also have the option of saving a gallery template as a .json file by using the Save-AzureResourceGroupGalleryTemplate cmdlet. Specify either the TemplateFile or TemplateUri parameter to specify that file.

You can also create a custom resource group template, either by typing in a text file or by editing a gallery template. To use a custom template to create a resource group, specify TemplateFile or TemplateUri.

The templates include parameters, which are placeholders for configurable property values, likes names and sizes. For more information about configurable properties and using the Tab key to discover them, see the New-AzureResourceGroup cmdlet.

Parameters

-GalleryTemplateIdentity<String>

Specifies the gallery template that this cmdlet uses for the new resource group deployment.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-Name<String>

Specifies the name of the new resource group deployment.

Aliases

DeploymentName

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-Profile<AzureProfile>

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-ResourceGroupName<String>

Specifies the name of the resource group to associate with the deployment.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-StorageAccountName<String>

Specifies the name of the storage account for which this cmdlet adds a deployment for a resource group. The default is the current storage account. If you have not selected a current storage account for your subscription, you must specify a storage account.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-TemplateFile<String>

Specifies the full path of a template file that this cmdlet uses for the resource group deployment. You can specify a custom template file or use the Save-AzureResourceGalleryTemplate cmdlet to save a gallery template to use with this parameter.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-TemplateParameterFile<String>

Specifies the full path of a file that contains template parameter values for the resource group for the new deployment.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-TemplateParameterObject<Hashtable>

Specifies a hash table that contains template parameter values for the resource group for the new deployment.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-TemplateUri<String>

Specifies the URI of a file that contains template parameter values for the resource group for the new deployment.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-TemplateVersion<String>

Specifies the version of a template that this cmdlet uses for the resource group for the new deployment.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • None

    You can pipe input to the cmdlet by property name, but not by value.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • Microsoft.Azure.Commands.ResourceManager.Models.PSResourceGroupDeployment

    This cmdlet returns the resource group deployment that it creates.

Examples

This command creates a resource group deployment from a gallery template. The command specifies template parameter values.

The GalleryTemplateIdentity parameter specifies the gallery template. You do not have to save the gallery template to disk. To add template parameters, after you enter the cmdlet parameters and values, type a minus sign, and then press the Tab key. Windows PowerShell supplies a parameter, such as siteMode. These parameters do not follow the Windows PowerShell standard of initial uppercase letter. Enter a value, and repeat this procedure, as needed. If you omit a required template parameter, the cmdlet prompts you for the value.

New-AzureResourceGroupDeployment -New-AzureResourceGroupDeployment -ResourceGroupName "ContosoRG01" -GalleryTemplateIdentity "Microsoft.WebSite.0.1.0-preview1" -Name "WebDeploy01" -siteName "ContosoWeb" -hostingPlanName "ContosoHosting" -siteMode "Limited" -computeMode "Dedicated" -siteLocation "North Europe" -subscriptionID "9b14a38b-4b93-4554-8bb0-3cefb47abcde" -resourceGroup "ContosoRG01"

Example 2: Use a custom template and parameter file

This command creates a deployment named ContosoEngineering based on a custom template and a template file. The TemplateFile parameter specifies the template. The TemplateParameterFile parameter specifies a file of parameters and parameter values. The TemplateVersion parameter specifies a version of the template. Because the command uses template files in a storage account of the subscription, the command specifies the storage account to use.

New-AzureResourceGroupDeployment -ResourceGroupName "ContosoEngineering" -TemplateFile "D:\Azure\Templates\EngineeringSite.json" -TemplateParameterFile "D:\Azure\Templates\EngSiteParms.json" -TemplateVersion "2.1" -StorageAccountName "contosostorage"

This example creates a new deployment by using a gallery template that is saved as a .json file and a hash table of parameter values.

The first command uses the Save-AzureResourceGroupGalleryTemplate cmdlet to save the WordPress gallery template as a .json file.

Save-AzureResourceGroupGalleryTemplate -Identity "WordPress.WordPress.0.1.0-preview1" -Path "D:\Azure\Templates"

The second command saves a hash table of the template parameter values in the $Params variable.

$Params = @{siteName="ContosoBlog";hostingPlanName="ContosoHosting";siteMode="Limited";computeMode="Shared";siteLocation="North Europe";sku="Shared";workerSize="0";databaseName=contosodb1;databaseLocation="South Central US";databaseSku="Free";subscriptionId="7363c612-d678-4171-a715-585c237abcde";resourceGroup="ContosoRG01";dbSubscriptionId="7363c612-d678-4171-a715-585c237abcde";dbResourceGroup="ContosoRG01"}

The third command adds a deployment to the resource group named ContosoRG01. The TemplateFile parameter specifies the gallery template file. The TemplateParameterObject cmdlet specifies $Params, which contains hash table of parameters and parameter values. . Because the command uses template files in a storage account of the subscription, the command specifies the storage account to use.

New-AzureResourceGroupDeployment -ResourceGroupName ContosoRG01 -TemplateFile D:\Azure\Templates\WordPress.WordPress.0.1.0-preview1.json -TemplateParameterObject $params -StorageAccountName contosostorage

Get-AzureResourceGroupDeployment

Stop-AzureResourceGroupDeployment

New-AzureResource

New-AzureResourceGroup

Save-AzureResourceGroupGalleryTemplate