Edit

Share via


Set-AzTemplateSpec

Modifies a Template Spec.

Syntax

FromJsonStringParameterSet (Default)

Set-AzTemplateSpec
    [-Location <String>]
    [-Tag <Hashtable>]
    [-UIFormDefinitionFile <String>]
    [-UIFormDefinitionString <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

UpdateByIdParameterSet

Set-AzTemplateSpec
    [-ResourceId] <String>
    [[-Description] <String>]
    [[-DisplayName] <String>]
    [-Location <String>]
    [-Tag <Hashtable>]
    [-UIFormDefinitionFile <String>]
    [-UIFormDefinitionString <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

UpdateVersionByIdFromJsonFileParameterSet

Set-AzTemplateSpec
    [-ResourceId] <String>
    [-Version] <String>
    [[-Description] <String>]
    [[-DisplayName] <String>]
    -TemplateFile <String>
    [-Location <String>]
    [-Tag <Hashtable>]
    [-VersionDescription <String>]
    [-UIFormDefinitionFile <String>]
    [-UIFormDefinitionString <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

UpdateVersionByIdFromJsonParameterSet

Set-AzTemplateSpec
    [-ResourceId] <String>
    [-Version] <String>
    [[-Description] <String>]
    [[-DisplayName] <String>]
    -TemplateJson <String>
    [-Location <String>]
    [-Tag <Hashtable>]
    [-VersionDescription <String>]
    [-UIFormDefinitionFile <String>]
    [-UIFormDefinitionString <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

UpdateByNameParameterSet

Set-AzTemplateSpec
    [-ResourceGroupName] <String>
    [-Name] <String>
    [[-Description] <String>]
    [[-DisplayName] <String>]
    [-Location <String>]
    [-Tag <Hashtable>]
    [-UIFormDefinitionFile <String>]
    [-UIFormDefinitionString <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

UpdateVersionByNameFromJsonFileParameterSet

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

UpdateVersionByNameFromJsonParameterSet

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

Description

Modifies a Template Spec. If the Template Spec with the specified name and/or specific version does not already exist, it will be created.

When modifying a Template Spec version's ARM Template content, the content can either come from a raw JSON string (using UpdateVersionByNameFromJsonParameterSet parameter set) or from a specified JSON/Bicep file (using UpdateVersionByNameFromJsonFileParameterSet parameter set).

Examples

Example 1

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

Modifies version "v1.0" of a Template Spec named "myTemplateSpec". The specified version will have $templateJson as the version's ARM Template content. If the root Template Spec and/or version do not already exist they will be created.

Notes:

  • The ARM Template in the example is a no-op as it contains no actual resources.
  • Location is only required when the Template Spec does not already exist

Example 2

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

Modifies version "v2.0" of 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. If the root Template Spec and/or version do not already exist they will be created.

Note: Location is only required when the Template Spec does not already exist

Example 3

Set-AzTemplateSpec -ResourceGroupName 'myRG' -Name 'myTemplateSpec'  -Location 'West US' -Description 'My updated Template Spec'

Modifies the description of the Template Spec named "myTemplateSpec" in resource group "myRG". If the Template Spec does not already exist it will be created.

Note: Location is only required when the Template Spec does not already exist

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

UpdateByIdParameterSet
Position:1
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateVersionByIdFromJsonFileParameterSet
Position:1
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateVersionByIdFromJsonParameterSet
Position:1
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateByNameParameterSet
Position:1
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateVersionByNameFromJsonFileParameterSet
Position:1
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateVersionByNameFromJsonParameterSet
Position:1
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

UpdateByIdParameterSet
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateVersionByIdFromJsonFileParameterSet
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateVersionByIdFromJsonParameterSet
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateByNameParameterSet
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateVersionByNameFromJsonFileParameterSet
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateVersionByNameFromJsonParameterSet
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
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

UpdateByNameParameterSet
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateVersionByNameFromJsonFileParameterSet
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateVersionByNameFromJsonParameterSet
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

UpdateByNameParameterSet
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateVersionByNameFromJsonFileParameterSet
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateVersionByNameFromJsonParameterSet
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-ResourceId

The fully qualified resource Id of the template spec. Example: /subscriptions/{subId}/resourceGroups/{rgName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}

Parameter properties

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

Parameter sets

UpdateByIdParameterSet
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateVersionByIdFromJsonFileParameterSet
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateVersionByIdFromJsonParameterSet
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 template spec and/or version

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

UpdateVersionByIdFromJsonFileParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateVersionByNameFromJsonFileParameterSet
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

UpdateVersionByIdFromJsonParameterSet
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateVersionByNameFromJsonParameterSet
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

UpdateVersionByIdFromJsonFileParameterSet
Position:3
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateVersionByIdFromJsonParameterSet
Position:3
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateVersionByNameFromJsonFileParameterSet
Position:3
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateVersionByNameFromJsonParameterSet
Position:3
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

UpdateVersionByIdFromJsonFileParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateVersionByIdFromJsonParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateVersionByNameFromJsonFileParameterSet
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
UpdateVersionByNameFromJsonParameterSet
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