New-AzureRmResourceGroupDeployment

Adds an Azure deployment to a resource group.

Warning

The AzureRM PowerShell module has been officially deprecated as of February 29, 2024. Users are advised to migrate from AzureRM to the Az PowerShell module to ensure continued support and updates.

Although the AzureRM module may still function, it's no longer maintained or supported, placing any continued use at the user's discretion and risk. Please refer to our migration resources for guidance on transitioning to the Az module.

Syntax

New-AzureRmResourceGroupDeployment
   [-Name <String>]
   -ResourceGroupName <String>
   [-Mode <DeploymentMode>]
   [-DeploymentDebugLogLevel <String>]
   [-RollbackToLastDeployment]
   [-RollBackDeploymentName <String>]
   [-Force]
   [-AsJob]
   -TemplateFile <String>
   [-ApiVersion <String>]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzureRmResourceGroupDeployment
   [-Name <String>]
   -ResourceGroupName <String>
   [-Mode <DeploymentMode>]
   [-DeploymentDebugLogLevel <String>]
   [-RollbackToLastDeployment]
   [-RollBackDeploymentName <String>]
   [-Force]
   [-AsJob]
   -TemplateParameterObject <Hashtable>
   -TemplateFile <String>
   [-ApiVersion <String>]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzureRmResourceGroupDeployment
   [-Name <String>]
   -ResourceGroupName <String>
   [-Mode <DeploymentMode>]
   [-DeploymentDebugLogLevel <String>]
   [-RollbackToLastDeployment]
   [-RollBackDeploymentName <String>]
   [-Force]
   [-AsJob]
   -TemplateParameterObject <Hashtable>
   -TemplateUri <String>
   [-ApiVersion <String>]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzureRmResourceGroupDeployment
   [-Name <String>]
   -ResourceGroupName <String>
   [-Mode <DeploymentMode>]
   [-DeploymentDebugLogLevel <String>]
   [-RollbackToLastDeployment]
   [-RollBackDeploymentName <String>]
   [-Force]
   [-AsJob]
   -TemplateParameterFile <String>
   -TemplateFile <String>
   [-ApiVersion <String>]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzureRmResourceGroupDeployment
   [-Name <String>]
   -ResourceGroupName <String>
   [-Mode <DeploymentMode>]
   [-DeploymentDebugLogLevel <String>]
   [-RollbackToLastDeployment]
   [-RollBackDeploymentName <String>]
   [-Force]
   [-AsJob]
   -TemplateParameterFile <String>
   -TemplateUri <String>
   [-ApiVersion <String>]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzureRmResourceGroupDeployment
   [-Name <String>]
   -ResourceGroupName <String>
   [-Mode <DeploymentMode>]
   [-DeploymentDebugLogLevel <String>]
   [-RollbackToLastDeployment]
   [-RollBackDeploymentName <String>]
   [-Force]
   [-AsJob]
   -TemplateParameterUri <String>
   -TemplateFile <String>
   [-ApiVersion <String>]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzureRmResourceGroupDeployment
   [-Name <String>]
   -ResourceGroupName <String>
   [-Mode <DeploymentMode>]
   [-DeploymentDebugLogLevel <String>]
   [-RollbackToLastDeployment]
   [-RollBackDeploymentName <String>]
   [-Force]
   [-AsJob]
   -TemplateParameterUri <String>
   -TemplateUri <String>
   [-ApiVersion <String>]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzureRmResourceGroupDeployment
   [-Name <String>]
   -ResourceGroupName <String>
   [-Mode <DeploymentMode>]
   [-DeploymentDebugLogLevel <String>]
   [-RollbackToLastDeployment]
   [-RollBackDeploymentName <String>]
   [-Force]
   [-AsJob]
   -TemplateUri <String>
   [-ApiVersion <String>]
   [-Pre]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The New-AzureRmResourceGroupDeployment cmdlet adds a deployment to an existing resource group. This includes the resources that the deployment requires. An Azure resource is a user-managed Azure entity, such as a database server, database, website, virtual machine, or Storage account. An Azure resource group is a collection of Azure resources that are deployed as a unit, such as the website, database server, and databases that are required for a financial website. A resource group deployment uses a template to add resources to a resource group and publishes them so that they are available in Azure. To add resources to a resource group without using a template, use the New-AzureRmResource cmdlet. To add a resource group deployment, specify the name of an existing resource group and a resource group template. A resource group template is a JSON string that represents a resource group for a complex cloud-based service, such as a web portal. The template includes parameter placeholders for required resources and configurable property values, such as names and sizes. You can find many templates in the Azure template gallery or you can create your own templates. You can use the Get-AzureRmResourceGroupGalleryTemplate cmdlet to find a template in the gallery. To use a custom template to create a resource group, specify the TemplateFile parameter or TemplateUri parameter. Each template has parameters for configurable properties. To specify values for the template parameters, specify the TemplateParameterFile parameter or the TemplateParameterObject parameter. Alternatively, you can use the template parameters that are dynamically added to the command when you specify a template. To use dynamic parameters, type them at the command prompt, or type a minus sign (-) to indicate a parameter and use the Tab key to cycle through available parameters. Template parameter values that you enter at the command prompt take precedence over values in a template parameter object or file.

Examples

Example 1: Use a custom template and parameter file to create a deployment

PS C:\>New-AzureRmResourceGroupDeployment -ResourceGroupName "ContosoEngineering" -TemplateFile "D:\Azure\Templates\EngineeringSite.json" -TemplateParameterFile "D:\Azure\Templates\EngSiteParms.json"

This command creates a new deployment by using a custom template and a template file on disk. The command uses the TemplateFile parameter to specify the template and the TemplateParameterFile parameter to specify a file that contains parameters and parameter values.

Parameters

-ApiVersion

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

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-AsJob

Run cmdlet in the background

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

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

Type:IAzureContextContainer
Aliases:AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DeploymentDebugLogLevel

Specifies a debug log level. The acceptable values for this parameter are:

  • RequestContent
  • ResponseContent
  • All
  • None
Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Mode

Specifies the deployment mode. The acceptable values for this parameter are:

  • Complete
  • Incremental In complete mode, Resource Manager deletes resources that exist in the resource group but are not specified in the template. In incremental mode, Resource Manager leaves unchanged resources that exist in the resource group but are not specified in the template.
Type:DeploymentMode
Position:Named
Default value:Incremental
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Name

Specifies the name of the resource group deployment to create.

Type:String
Aliases:DeploymentName
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-Pre

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

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-ResourceGroupName

Specifies the name of the resource group to deploy.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-RollBackDeploymentName

Rollback to the successful deployment with the given name in the resource group, should not be used if -RollbackToLastDeployment is used.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-RollbackToLastDeployment

Rollback to the last successful deployment in the resource group, should not be present if -RollBackDeploymentName is used.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-TemplateFile

Specifies the full path of a JSON template file. This can be a custom template or a gallery template that is saved as a JSON file, such as one created by using the Save-AzureRmResourceGroupGalleryTemplate cmdlet.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TemplateParameterFile

Specifies the full path of a JSON file that contains the names and values of the template parameters. If a template has parameters, you must specify the parameter values with the TemplateParameterFile parameter or the TemplateParameterObject parameter. Template parameters are dynamically added to the command when you specify a template. To use the dynamic parameters, type a minus sign (-) to indicate a parameter name and then use the Tab key to cycle through the available parameters.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TemplateParameterObject

Specifies a hash table of template parameter names and values. For help with hash tables in Windows PowerShell, type Get-Help about_Hash_Tables. If a template has parameters, you must specify parameter values. Template parameters are dynamically added to the command when you specify a template.

Type:Hashtable
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TemplateParameterUri

Specifies the URI of a template parameters file.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-TemplateUri

Specifies the URI of a JSON template file. This file can be a custom template or a gallery template that is saved as a JSON file, such as by using Save-AzureRmResourceGroupGalleryTemplate.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None

Outputs

Microsoft.Azure.Commands.ResourceManager.Models.PSResourceGroupDeployment