Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

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

-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

-Description

The description of the template spec.

Parameter properties

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

Parameter sets

-DisplayName

The display name of the template spec.

Parameter properties

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

Parameter sets

-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

-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

-Name

The name of the template spec.

Parameter properties

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

Parameter sets

-ResourceGroupName

The name of the resource group.

Parameter properties

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

Parameter sets

-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

-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

-TemplateJson

The Azure Resource Manager template JSON.

Parameter properties

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

Parameter sets

-UIFormDefinitionFile

UIForm for the templatespec resource

Parameter properties

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

Parameter sets

-UIFormDefinitionString

UIForm for the templatespec resource

Parameter properties

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

Parameter sets

-Version

The version of the template spec.

Parameter properties

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

Parameter sets

-VersionDescription

The description of the version.

Parameter properties

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

Parameter sets

-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

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


Feedback

Was this page helpful?