Save-AzTenantDeploymentTemplate
Save the template used by a tenant-scope deployment to a file.
Syntax
Default (Default)
Save-AzTenantDeploymentTemplate
[-DeploymentName] <string>
[-Path <string>]
[-Force]
[-Profile <string>]
[<CommonParameters>]
Aliases
This cmdlet has no aliases.
Description
Exports the template used by a tenant deployment and writes it to a JSON file. Without -Path,
the file is <DeploymentName>.json in the current location. When -Path is an existing folder,
the file is written there as <DeploymentName>.json; otherwise -Path is the file itself and
gains a .json extension when it lacks one. An existing file is overwritten only with -Force.
Examples
Save a deployment template to the current location
Save-AzTenantDeploymentTemplate -DeploymentName tenant-infra
Save a deployment template to a folder, overwriting an existing file
Save-AzTenantDeploymentTemplate -DeploymentName tenant-infra -Path .\templates -Force
Parameters
-DeploymentName
The name of the deployment whose template to save.
Parameter properties
| Type: | String |
| Supports wildcards: | False |
| DontShow: | False |
| Aliases: | Name |
Parameter sets
(All)
| Position: | 0 |
| Mandatory: | True |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-Force
Overwrite the template file when it already exists.
Parameter properties
| Type: | SwitchParameter |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-Path
The file or folder to write the template to. A folder receives '<DeploymentName>.json'. Defaults to the current location.
Parameter properties
| Type: | String |
| Supports wildcards: | False |
| DontShow: | False |
Parameter sets
(All)
| Position: | Named |
| Mandatory: | False |
| Value from pipeline: | False |
| Value from pipeline by property name: | False |
| Value from remaining arguments: | False |
-Profile
Name of a saved profile to use for this call instead of the currently-active one. Manage profiles with Set-AzProfile / Get-AzProfile.
Parameter properties
| Type: | String |
| Supports wildcards: | False |
| DontShow: | False |
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
None
This cmdlet does not accept pipeline input.
Outputs
Microsoft.Azure.Azclips.Extensions.Resources.Processors.DeploymentTemplateSaveResult
An object whose Path property is the full path of the template file that was written.
Notes
Differences from Az.Resources: an existing file without -Force raises an error instead of prompting for confirmation, and a response without a template raises an error. -DeploymentObject, -WhatIf, -Confirm, and -Pre are not supported.