New-AzTemplateSpec

Creates a new Template Spec.

Syntax

New-AzTemplateSpec
   [-ResourceGroupName] <String>
   [-Name] <String>
   -Version <String>
   [-Description <String>]
   [-DisplayName <String>]
   [-Location <String>]
   [-Tag <Hashtable>]
   -TemplateJson <String>
   [-VersionDescription <String>]
   [-Force]
   [-UIFormDefinitionFile <String>]
   [-UIFormDefinitionString <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
New-AzTemplateSpec
   [-ResourceGroupName] <String>
   [-Name] <String>
   -Version <String>
   [-Description <String>]
   [-DisplayName <String>]
   [-Location <String>]
   [-Tag <Hashtable>]
   -TemplateFile <String>
   [-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.

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:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Description

The description of the template spec.

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

-DisplayName

The display name of the template spec.

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

-Force

Do not ask for confirmation when overwriting an existing version.

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

-Location

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

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

-Name

The name of the template spec.

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

-ResourceGroupName

The name of the resource group.

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

-Tag

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

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

-TemplateFile

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

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

-TemplateJson

The Azure Resource Manager template JSON.

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

-UIFormDefinitionFile

UIForm for the templatespec resource

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

-UIFormDefinitionString

UIForm for the templatespec resource

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

-Version

The version of the template spec.

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

-VersionDescription

The description of the version.

Type:String
Position:Named
Default value:None
Required:False
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

String

Outputs

PSTemplateSpec