Edit

Remove-AzManagementGroupDeployment

Removes a management-group deployment from deployment history.

Syntax

RemoveByDeploymentName (Default)

Remove-AzManagementGroupDeployment
    [-ManagementGroupId] <string>
    [-Name] <string>
    [-PassThru]
    [-Profile <string>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

RemoveByDeploymentId

Remove-AzManagementGroupDeployment
    -Id <string>
    [-PassThru]
    [-Profile <string>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

RemoveByInputObject

Remove-AzManagementGroupDeployment
    -InputObject <DeploymentExtended>
    [-PassThru]
    [-Profile <string>]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

Aliases

This cmdlet has no aliases.

Description

Deletes deployment history and associated deployment operations. The target can be supplied by management group and name, full deployment ID, or pipeline input object. The cmdlet sends the delete request without checking existence first. Removing a deployment that does not exist succeeds. The cmdlet returns no output by default, or true with -PassThru. Deleting deployment history does not delete the deployed resources.

Examples

Example 1

Removes deployment history by management group and name.

Remove-AzManagementGroupDeployment -ManagementGroupId myManagementGroup -Name myDeployment -Confirm:$false

Example 2

Removes deployment history supplied through the pipeline and returns true on success.

Get-AzManagementGroupDeployment -ManagementGroupId myManagementGroup -Name myDeployment |
    Remove-AzManagementGroupDeployment -PassThru -Confirm:$false

Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Id

The full management-group deployment resource ID, for example /providers/Microsoft.Management/managementGroups/myManagementGroup/providers/Microsoft.Resources/deployments/myDeployment. Use this instead of -ManagementGroupId and -Name.

Parameter properties

Type:String
Supports wildcards:False
DontShow:False
Aliases:DeploymentId, ResourceId

Parameter sets

RemoveByDeploymentId
Position:Named
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-InputObject

A deployment object returned by Get-AzManagementGroupDeployment. Its Id identifies the deployment history to remove. Accepts pipeline input.

Parameter properties

Type:Microsoft.Azure.Azclips.Extensions.Resources.Models.DeploymentExtended
Supports wildcards:False
DontShow:False

Parameter sets

RemoveByInputObject
Position:Named
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:False
Value from remaining arguments:False

-ManagementGroupId

The management group ID.

Parameter properties

Type:String
Supports wildcards:False
DontShow:False

Parameter sets

RemoveByDeploymentName
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-Name

The deployment name.

Parameter properties

Type:String
Supports wildcards:False
DontShow:False
Aliases:DeploymentName

Parameter sets

RemoveByDeploymentName
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PassThru

Writes true after the delete call returns without a terminating error, including when the deployment did not exist. No value is written when -WhatIf or a declined confirmation skips deletion.

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

-Profile

The AzClips profile to use instead of the active profile.

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

-WhatIf

Shows PowerShell's deletion action message without sending a delete request. No -PassThru value is written.

Parameter properties

Type:SwitchParameter
Supports wildcards:False
DontShow:False
Aliases:wi

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

Microsoft.Azure.Azclips.Extensions.Resources.Models.DeploymentExtended

Accepts a management-group deployment object from the pipeline.

Outputs

Boolean

With -PassThru, writes true after the delete call when deletion is not skipped. No output by default.

Notes

Removing deployment history does not delete resources created by the deployment. The legacy -Pre and -AsJob switches are not supported.