Remove-AzDisk
Synopsis: Deletes a managed disk from your Azure subscription.
Syntax
Remove-AzDisk [-ResourceGroupName] <String> [-DiskName] <String> [-Force] [-PassThru] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]Remove-AzDisk -InputObject <PSDisk> [-Force] [-PassThru] [-DefaultProfile <IAzureContextContainer>] [<CommonParameters>]Parameters
| Name | Type | Required | Description | 
|---|---|---|---|
| -ResourceGroupName String | String | Yes | Name of the resource group that contains the disk. | 
| -DiskName String | String | Yes | Name of the managed disk to delete. | 
| -InputObject PSDisk | PSDisk | No | Disk object retrieved from Get-AzDisk. Provides both-ResourceGroupNameand-DiskName. | 
| -Force | SwitchParameter | No | Suppresses confirmation prompt. | 
| -PassThru | SwitchParameter | No | Returns the deleted disk object. | 
| -DefaultProfile | IAzureContextContainer | No | Specifies the Azure context to use. | 
| <CommonParameters> | — | — | Standard PowerShell common parameters (e.g., -Verbose,-ErrorAction). | 
Examples
Example 1: Delete a managed disk by name
# Delete a disk named "myDisk" in resource group "myRG"
Remove-AzDisk -ResourceGroupName "myRG" -DiskName "myDisk" -ForceExample 2: Delete a disk using the object pipeline
# Get the disk object then pipe to Remove-AzDisk
Get-AzDisk -ResourceGroupName "myRG" -DiskName "myDisk" | Remove-AzDisk -ForceExample 3: Delete a disk and receive the deleted object
# The deleted disk details are returned for audit purposes
$deletedDisk = Remove-AzDisk -ResourceGroupName "myRG" -DiskName "myDisk" -PassThru
$deletedDisk | Format-ListRemarks
- The command permanently deletes the managed disk. Ensure the disk is no longer needed or has been backed up.
- If the disk is attached to a virtual machine, detach it before removal or use -Forceto skip the confirmation (the VM will be stopped automatically).
- Deleted disks cannot be recovered. Consider using snapshots for backup.