Hello Tajman Kaur,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
I understand that you would like to have PowerShell script which can help you to find utilization details of the disks attached to a particular virtual machine in Azure.
Yes, there are scripts you can use PowerShell to find the utilization details of disks attached to a virtual machine in Microsoft Azure. This script below will connect to your Azure account, retrieve the specified VM, and run a PowerShell script inside the VM to get the disk utilization details, including the drive letter, total size, and free space for each disk - https://learn.microsoft.com/en-us/azure/virtual-machines/windows/tutorial-manage-data-disk
Follow the steps in the script's comments:
# Install the Azure PowerShell module** if you haven't already:
Install-Module -Name Az -AllowClobber -Scope CurrentUser
# Connect to your Azure account**:
Connect-AzAccount
# The following script will get the disk utilization details, start by define the VM details:
$resourceGroupName = "YourResourceGroupName"
$vmName = "YourVMName"
# Get the VM
$vm = Get-AzVM -ResourceGroupName $resourceGroupName -Name $vmName
# Run a script inside the VM to get disk utilization details
$script = @" Get-Volume | Select-Object DriveLetter, @{Name='Size(GB)';Expression= {[math]::round($_.Size/1GB,2)}}, @{Name='FreeSpace(GB)';Expression={[math]::round($_.SizeRemaining/1GB,2)}}
"@
# Execute the script inside the VM
$result = Invoke-AzVMRunCommand -ResourceGroupName $resourceGroupName -VMName $vmName -CommandId 'RunPowerShellScript' -ScriptString $script
# Display the result
$result.Value[0].Message
I hope this is helpful! Do not hesitate to let me know if you have any other questions.
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.