New-AzureRmDeployment
Creat a deployment
Important
Because Az PowerShell modules now have all the capabilities of AzureRM PowerShell modules and more, we'll retire AzureRM PowerShell modules on 29 February 2024.
To avoid service interruptions, update your scripts that use AzureRM PowerShell modules to use Az PowerShell modules by 29 February 2024. To automatically update your scripts, follow the quickstart guide.
Syntax
New-AzureRmDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-AsJob]
-TemplateFile <String>
[-ApiVersion <String>]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzureRmDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-AsJob]
-TemplateParameterObject <Hashtable>
-TemplateFile <String>
[-ApiVersion <String>]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzureRmDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-AsJob]
-TemplateParameterObject <Hashtable>
-TemplateUri <String>
[-ApiVersion <String>]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzureRmDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-AsJob]
-TemplateParameterFile <String>
-TemplateFile <String>
[-ApiVersion <String>]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzureRmDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-AsJob]
-TemplateParameterFile <String>
-TemplateUri <String>
[-ApiVersion <String>]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzureRmDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-AsJob]
-TemplateParameterUri <String>
-TemplateFile <String>
[-ApiVersion <String>]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzureRmDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-AsJob]
-TemplateParameterUri <String>
-TemplateUri <String>
[-ApiVersion <String>]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
New-AzureRmDeployment
[-Name <String>]
-Location <String>
[-DeploymentDebugLogLevel <String>]
[-AsJob]
-TemplateUri <String>
[-ApiVersion <String>]
[-Pre]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The New-AzureRmDeployment cmdlet adds a deployment at the current subscription scope. This includes the resources that the deployment requires.
An Azure resource is a user-managed Azure entity. A resource can live in a resource group, like database server, database, website, virtual machine, or Storage account. Or, it can be a subscription level resource, like role definition, policy definition, etc.
To add resources to a resource group, use the New-AzureRmDeployment which creates a deployment at a resource group. The New-AzureRmDeployment cmdlet creates a deployment at the current subscription scope, which deploys subscription level resources.
To add a deployment at subscription, specify the location and a template. The location tells Azure Resource Manager where to store the deployment data. The template is a JSON string that contains individual resources to be deployed. The template includes parameter placeholders for required resources and configurable property values, such as names and sizes.
To use a custom template for the deployment, 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-AzureRmDeployment -Location "West US" -TemplateFile "D:\Azure\Templates\EngineeringSite.json" -TemplateParameterFile "D:\Azure\Templates\EngSiteParms.json" -TemplateVersion "2.1"
This command creates a new deployment at the current subscription scope 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. It uses the TemplateVersion parameter to specify the version of the template.
Parameters
When set, indicates the version of the resource provider API to use. If not specified, the API version is automatically determined as the latest available.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Run cmdlet in the background
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Prompts you for confirmation before running the cmdlet.
Type: | SwitchParameter |
Aliases: | cf |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
The credentials, account, tenant, and subscription used for communication with Azure.
Type: | IAzureContextContainer |
Aliases: | AzureRmContext, AzureCredential |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
The deployment debug log level.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
The location to store deployment data.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
The name of the deployment it's going to create. Only valid when a template is used. When a template is used, if the user doesn't specify a deployment name, use the current time, like "20131223140835".
Type: | String |
Aliases: | DeploymentName |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
When set, indicates that the cmdlet should use pre-release API versions when automatically determining which version to use.
Type: | SwitchParameter |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Local path to the template file.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
A file that has the template parameters.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
A hash table which represents the parameters.
Type: | Hashtable |
Position: | Named |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Uri to the template parameter file.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Uri to the template file.
Type: | String |
Position: | Named |
Default value: | None |
Accept pipeline input: | True |
Accept wildcard characters: | False |
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: | SwitchParameter |
Aliases: | wi |
Position: | Named |
Default value: | None |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
System.Collections.Hashtable