0
votes

Get-AzAdvisorRecommendation -Category Cost | Where-Object {$_.ImpactedField -eq "Microsoft.Compute/virtualMachines"}

I'm trying to get the Cost Property for Virtual MAchines on "Shut down or resize your virtual machine" but not able to get it similar with the Data shows in portal

Automate the advisor recommendations using PowerShell.

2

2 Answers

0
votes

The command seems right. I don't have this Azure advice myself, but I can look for

Get-AzAdvisorRecommendation -Category Cost | 
Where-Object {$_.ImpactedField -eq "Microsoft.Network/publicIPAddresses"}

and it gives me the corresponding advice. This should also work with "Microsoft.Compute/virtualMachines".

Are you sure the error is displayed when you omit the pipe?

0
votes

Get-AzAdvisorRecommendation -Category Cost | Where-Object {$_.ImpactedField -eq "Microsoft.Compute/virtualMachines"} | Select-Object -ExpandProperty ExtendedProperties

I got the required answer with the query..

Thanks Casper!