New-AzureRmDeployment
Creat a deployment
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-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
-ApiVersion
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 |
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: | None |
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
The deployment debug log level.
Type: | String |
Position: | Named |
Default value: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Location
The location to store deployment data.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Name
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 |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-Pre
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 |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
-TemplateFile
Local path to the template file.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TemplateParameterFile
A file that has the template parameters.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TemplateParameterObject
A hash table which represents the parameters.
Type: | Hashtable |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TemplateParameterUri
Uri to the template parameter file.
Type: | String |
Position: | Named |
Default value: | None |
Required: | True |
Accept pipeline input: | True |
Accept wildcard characters: | False |
-TemplateUri
Uri to the template file.
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: | None |
Required: | False |
Accept pipeline input: | False |
Accept wildcard characters: | False |
Inputs
System.Collections.Hashtable