編輯

共用方式為


Get-AzTemplateSpec

Gets or lists Template Specs

Syntax

Get-AzTemplateSpec
   [[-ResourceGroupName] <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
Get-AzTemplateSpec
   [-ResourceGroupName] <String>
   [-Name] <String>
   [[-Version] <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [<CommonParameters>]
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.

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

-Version

The version of the template spec.

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

Inputs

String

Outputs

PSTemplateSpec