Reputation: 2149
Im trying to write a powershell query to return the following table:
NAME STATUS RESOURCE GROUP VMSIZE SIZEREASON (TAG) LOCATION PUBLIC DNS NAME
I can use Get-AzureRmVM | Select-Object Name, ResourceGroupName, Location
but when I try to add on VmSize, the column is there but without values.
If I run just Get-AzureRmVM
then I get the VmSize, so I don't understand why I can't select it.
I also need to work out how to add in Status, SIZEREASON (TAG),PUBLIC DNS NAME
Any guidence is most appreciated.
Its also worth noting, that my table also needs to contain both Resource Managed VM's and Classic VM's (So all VM's)
UPDATE
My Powershell query is currently:
Get-AzureRmVm `
| Select-Object ResourceGroupName `
, Name `
, Location `
, @{Name="VmSize"; Expression={$_.ToPSVirtualMachine().HardwareProfile.VmSize}} `
, @{Name="SizeReason(Tag)"; Expression={$_.ToPSVirtualMachine().Tags.Values}} `
, FullyQualifiedDomainName `
| Format-Table
The outstanding problems are:
Upvotes: 0
Views: 381
Reputation: 17161
This was trickier than I expected....
Get-AzureRmVm | Select-Object @{Name="VmSize"; Expression={$_.ToPSVirtualMachine().HardwareProfile.VmSize}}
Upvotes: 1