Edit

Share via


New-AzTemplateSpec

Creates a new Template Spec.

Syntax

FromJsonStringParameterSet (Default)

New-AzTemplateSpec
    [-ResourceGroupName] <String>
    [-Name] <String>
    -Version <String>
    -TemplateJson <String>
    [-Description <String>]
    [-DisplayName <String>]
    [-Location <String>]
    [-Tag <Hashtable>]
    [-VersionDescription <String>]
    [-Force]
    [-UIFormDefinitionFile <String>]
    [-UIFormDefinitionString <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

FromJsonFileParameterSet

New-AzTemplateSpec
    [-ResourceGroupName] <String>
    [-Name] <String>
    -Version <String>
    -TemplateFile <String>
    [-Description <String>]
    [-DisplayName <String>]
    [-Location <String>]
    [-Tag <Hashtable>]
    [-VersionDescription <String>]
    [-Force]
    [-UIFormDefinitionFile <String>]
    [-UIFormDefinitionString <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Description

Creates a new Template Spec version with the specified ARM Template content. The content can either come from a raw JSON string (using FromJsonStringParameterSet parameter set) or from a specified JSON/Bicep file (using FromJsonFileParameterSet parameter set).

If the root Template Spec does not already exist it will be created along with the Template Spec version. If a Template Spec already exists with the given name, it and the specified version will be updated (any other existing versions will be preserved).

Examples

Example 1

$templateJson = @"
{
    "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {},
    "resources": []
}
"@
New-AzTemplateSpec -ResourceGroupName 'myRG' -Name 'myTemplateSpec' -Version 'v1.0' -Location 'West US' -TemplateJson $templateJson

Creates a new Template Spec version "v1.0" in a Template Spec named "myTemplateSpec". The specified version will have $templateJson as the version's ARM Template content.

Note: The ARM Template in the example is a no-op as it contains no actual resources.

Example 2

New-AzTemplateSpec -ResourceGroupName 'myRG' -Name 'myTemplateSpec' -Version 'v2.0' -Location 'West US' -TemplateFile 'myTemplateContent.json'

Creates a new Template Spec version "v2.0" in a Template Spec named "myTemplateSpec". The specified version will have the content from the local file "myTemplateContent.json" as the version's ARM Template content.

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Parameter properties

Type:IAzureContextContainer
Default value:None
Supports wildcards:False
DontShow:False
Aliases:AzContext, AzureRmContext, AzureCredential

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Description

The description of the template spec.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-DisplayName

The display name of the template spec.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Force

Do not ask for confirmation when overwriting an existing version.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Location

The location of the template spec. Only required if the template spec does not already exist.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Name

The name of the template spec.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ResourceGroupName

The name of the resource group.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Tag

Hashtable of tags for the new template spec resource(s).

Parameter properties

Type:Hashtable
Default value:None
Supports wildcards:False
DontShow:False
Aliases:Tags

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-TemplateFile

The file path to the local Azure Resource Manager template JSON/Bicep file.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False
Aliases:InputFile

Parameter sets

FromJsonFileParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-TemplateJson

The Azure Resource Manager template JSON.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromJsonStringParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-UIFormDefinitionFile

UIForm for the templatespec resource

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-UIFormDefinitionString

UIForm for the templatespec resource

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-Version

The version of the template spec.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-VersionDescription

The description of the version.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-WhatIf

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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

String

Outputs

PSTemplateSpec