Nov 29 2017 11:43 PM
I want to list all the VMs ( all Resources Group) inside the azure with creation date, then all the Drives which I attached and unattached status.
Anyone one have the steps or any python scripts available?
Dec 01 2017 11:42 AM
This will get the Status and Details of all Vms in ARM
$RGs = Get-AzureRMResourceGroup
foreach($RG in $RGs)
{
$VMs = Get-AzureRmVM -ResourceGroupName $RG.ResourceGroupName
foreach($VM in $VMs)
{
$VMDetail = Get-AzureRmVM -ResourceGroupName $RG.ResourceGroupName -Name $VM.Name -Status
foreach ($VMStatus in $VMDetail.Statuses)
{
if($VMStatus.Code.CompareTo("PowerState/deallocated") -eq 0)
{
$VMStatusDetail = $VMStatus.DisplayStatus
}
}
write-output $VM.Name $VMStatusDetail
}
}