Get-AzureSubscription | ForEach-Object {
$mySubscriptionName = $_.SubscriptionName
Select-AzureSubscription -SubscriptionName $mySubscriptionName
Get-AzureVM | ForEach-Object {
$myVM = $_
$myService=$myVM | Get-AzureService
$myDeployment = $myService | Get-AzureDeployment
$output =
$hashtable = @{Name=$myVM.Name; PowerState=$myVM.PowerState; InstanceSize=$myVM.InstanceSize; PublicIPAddress=$myDeployment.VirtualIPs[0].Address; IpAddress=$myVM.IpAddress; OS=$myVM.VM.OSVirtualHardDisk.OS; Location=$myService.Location; SubscriptionName=$mySubscriptionName}
New-Object PSObject -Property $hashtable
}
}| Format-Table -Property Name,PowerState,InstanceSize,PublicIPAddress,IpAddress,OS,Location,SubscriptionName -AutoSize