Redigera

Dela via


Set-AzTemplateSpec

Modifies a Template Spec.

Syntax

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

Description

Modifies a Templace 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.

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:1
Default value:None
Required:False
Accept pipeline input:True
Accept wildcard characters:False

-DisplayName

The display name of the template spec.

Type:String
Position:2
Default value:None
Required:False
Accept pipeline input:True
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

-ResourceId

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

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

-Tag

Hashtable of tags for the template spec and/or version

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:3
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