Edit

Share via


Get-AzTemplateSpec

Gets or lists Template Specs

Syntax

ListTemplateSpecsParameterSet (Default)

Get-AzTemplateSpec
    [[-ResourceGroupName] <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

GetTemplateSpecByNameParameterSet

Get-AzTemplateSpec
    [-ResourceGroupName] <String>
    [-Name] <String>
    [[-Version] <String>]
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

GetTemplateSpecByIdParameterSet

Get-AzTemplateSpec
    [[-Version] <String>]
    [-ResourceId] <String>
    [-DefaultProfile <IAzureContextContainer>]
    [<CommonParameters>]

Description

This cmdlet can be used to list Template Specs in a subscription/resource group or get a specific Template Spec by name or id. When getting a specific Template Spec by name/id a specific version can optionally be retrieved by specifying a version name through the -Version parameter. When -Version is used, only the specific version details will be present within *.Versions on the returned Template Spec object. If no specific version is specified when retrieving a Template Spec by name/id, all versions will be present within the *.Versions property of the returned object.

Note: When listing all Template Specs within a subscription or resource group, each returned Template Spec's ".Versions" property will be null. Version information is only included when -Name or -ResourceId parameters are provided (eg: you are requesting a specific template spec/version).

Examples

Example 1: List Template Specs in current subscription

Get-AzTemplateSpec

Lists all Template Specs in the current subscription.

Example 2: List Template Specs in a resource group

Get-AzTemplateSpec -ResourceGroupName 'myRG'

Lists all Template Specs in the resource group 'myRG' of the current subscription.

Example 3: Get Template Spec (with all versions) by name

Get-AzTemplateSpec -ResourceGroupName 'myRG' -Name 'MyTemplateSpec'

Gets information about the Template Spec named 'MyTemplateSpec' within the resource group 'myRG'.

Note: All of the Template Spec's versions will be present within the ".Versions" property of the return object.

Example 4: Get Template Spec (specific version) by name

Get-AzTemplateSpec -ResourceGroupName 'myRG' -Name 'MyTemplateSpec' -Version 'v1.0'

Gets information about version 'v1.0' of the Template Spec named 'MyTemplateSpec' within the resource group 'myRG'.

Note: The ".Versions" property of the returned object will contain only the specific version requested.

Example 5: Get Template Spec (with all versions) by resource id

Get-AzTemplateSpec -ResourceId '/subscriptions/{subId}/resourceGroups/myRG/providers/Microsoft.Resources/templateSpecs/MyTemplateSpec'

Gets information about the Template Spec named 'MyTemplateSpec' within the resource group 'myRG' of subscription {subId}.

Note: All of the Template Spec's versions will be present within the ".Versions" property of the return object.

Example 6: Get Template Spec (specific version) by resource id

Get-AzTemplateSpec -ResourceId '/subscriptions/{subId}/resourceGroups/myRG/providers/Microsoft.Resources/templateSpecs/MyTemplateSpec' -Version 'v1.0'

Gets information about version 'v1.0' of the Template Spec named 'MyTemplateSpec' within the resource group 'myRG' of subscription {subId}.

Note: The ".Versions" property of the returned object will contain only the specific version requested.

Parameters

-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

-Name

The name of the template spec.

Parameter properties

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

Parameter sets

GetTemplateSpecByNameParameterSet
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

ListTemplateSpecsParameterSet
Position:0
Mandatory:False
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

GetTemplateSpecByIdParameterSet
Position:0
Mandatory:True
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

GetTemplateSpecByNameParameterSet
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False
GetTemplateSpecByIdParameterSet
Position:2
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:True
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