Skip to content

Commit 783033d

Browse files
Merge pull request #269839 from roygara/timeUpdate
Adding parameter information
2 parents fefe77a + 0d34535 commit 783033d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

articles/virtual-machines/linux/find-unattached-disks.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ ms.custom: devx-track-azurecli
1515

1616
When you delete a virtual machine (VM) in Azure, by default, any disks that are attached to the VM aren't deleted. This feature helps to prevent data loss due to the unintentional deletion of VMs. After a VM is deleted, you will continue to pay for unattached disks. This article shows you how to find and delete any unattached disks and reduce unnecessary costs.
1717

18+
> [!NOTE]
19+
> You can use the [az disk show](/cli/azure/disk?view=azure-cli-latest) command to get the LastOwnershipUpdateTime for any disk. This property represents when the disk’s state was last updated. For an unattached disk, this will show the time when the disk was unattached. Note that this property will be blank for a new disk until its disk state is changed.
20+
1821

1922
## Managed disks: Find and delete unattached disks
2023

articles/virtual-machines/windows/find-unattached-disks.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@ ms.author: rogarana
99
ms.custom: devx-track-azurepowershell
1010
---
1111

12-
# Find and delete unattached Azure managed and unmanaged disks
12+
# Find and delete unattached Azure managed and unmanaged disks by using Azure PowerShell
1313

1414
**Applies to:** :heavy_check_mark: Linux VMs :heavy_check_mark: Windows VMs :heavy_check_mark: Flexible scale sets :heavy_check_mark: Uniform scale sets
1515

1616
When you delete a virtual machine (VM) in Azure, by default, any disks that are attached to the VM aren't deleted. This feature helps to prevent data loss due to the unintentional deletion of VMs. After a VM is deleted, you will continue to pay for unattached disks. This article shows you how to find and delete any unattached disks and reduce unnecessary costs.
1717

18+
> [!NOTE]
19+
> You can use the [Get-AzureDisk](/powershell/module/servicemanagement/azure/get-azuredisk?view=azuresmps-4.0.0) command to get the `LastOwnershipUpdateTime` for any disk. This property represents when the disk’s state was last updated. For an unattached disk, this will show the time when the disk was unattached. Note that this property will be blank for a new disk until its disk state is changed.
20+
1821
## Managed disks: Find and delete unattached disks
1922

2023
The following script looks for unattached [managed disks](../managed-disks-overview.md) by examining the value of the **ManagedBy** property. When a managed disk is attached to a VM, the **ManagedBy** property contains the resource ID of the VM. When a managed disk is unattached, the **ManagedBy** property is null. The script examines all the managed disks in an Azure subscription. When the script locates a managed disk with the **ManagedBy** property set to null, the script determines that the disk is unattached.

0 commit comments

Comments
 (0)