共用方式為


Save-AzureResourceGroupGalleryTemplate

Save-AzureResourceGroupGalleryTemplate

Saves a gallery template as a .json file.

Syntax

Parameter Set: Default
Save-AzureResourceGroupGalleryTemplate [-Identity] <String> [[-Path] <String> ] [[-Force]] [-Profile <AzureProfile> ] [ <CommonParameters>]

Detailed Description

The Save-AzureResourceGroupGalleryTemplate cmdlet saves a resource group template from the Azure template gallery in JavaScript Object Notation (JSON) format. The cmdlet returns the full path of the .json file that it creates.

For more information about resource groups, see the New-AzureResourceGroup cmdlet. For more information about resource group templates, see the Test-AzureResourceGroupTemplate cmdlet.

Parameters

-Force

Forces the command to run without asking for user confirmation.

Aliases

none

Required?

false

Position?

3

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

-Identity<String>

Specifies the resource group template that this cmdlet saves as a .json file.

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-Path<String>

Specifies the path of a folder where this cmdlet saves the resource group template as a .json file.

Aliases

none

Required?

false

Position?

2

Default Value

none

Accept Pipeline Input?

true(ByPropertyName)

Accept Wildcard Characters?

false

-Profile<AzureProfile>

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

false

Accept Wildcard Characters?

false

<CommonParameters>

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see    about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Inputs

The input type is the type of the objects that you can pipe to the cmdlet.

  • None

    You can pipe input to the cmdlet by property name, but not by value.

Outputs

The output type is the type of the objects that the cmdlet emits.

  • System.Management.Automation.PSCustomObject

    This cmdlet returns the path of the .json file.

Examples

Example 1: Save a template

This command saves the Microsoft.WebSite.0.1.0-preview1 template to the current folder as Microsoft.WebSite.0.1.0-preview1.json.

Save-AzureResourceGroupGalleryTemplate -Identity "Microsoft.WebSite.0.1.0-preview1"

Example 2: Save a template in a specified folder

This command gets the resource group template Microsoft.WebSite.0.1.0-preview1 by using the Get-AzureResourceGroupGalleryTemplate cmdlet. The command passes the template to the current cmdlet by using the pipeline operator. The current cmdlet saves the template as .json file in the folder that the command specifies.

Get-AzureResourceGroupGalleryTemplate -Identity "Microsoft.WebSite.0.1.0-preview1" | Save-AzureResourceGroupGalleryTemplate -Path "C:\Users\User01\Documents\MyTemplates"

Get-AzureResourceGroupGalleryTemplate

New-AzureResourceGroup

Test-AzureResourceGroupTemplate