Johnbosco
Johnbosco

Reputation: 65

How to get the disk capacity and free space of unattached disks in Azure

I have been researching, but is there a way to get the disk capacity and free space of unattached disks in Azure?

Upvotes: 0

Views: 1497

Answers (1)

Stanley Gong
Stanley Gong

Reputation: 12153

As far as I know, you can't get a free space of unattached disks. If it is necessary to do so , you should attach it to an Azure VM so that you can use run command feature of Azure VMs to run a PowerShell script on windows VM or run a shell script on Linux VM to get free disk space directly.

If you want to get disk capacity, you can use rest API or SDK or Powershell command below to get it directly:

$disk = Get-AzDisk -DiskName <disk name> -ResourceGroupName <resource group name>
$disk.DiskSizeGB

enter image description here

Upvotes: 1

Related Questions