
09 Aug Azure PowerShell: Get Amount of VM Cores per Region
If you need a script which outputs you the overall VMCore amount per region, there you go.
This is a snippet from a RunBook which iterates also through each subscription before, so you would get all amount of used cores per subscription as well as per region.
I took the advantage of using Get-AzureRmVMUsage.
So you can use this two-liner
$myloc = Get-AzureRmLocation | select DisplayName foreach($loc in $myloc){ Get-AzureRmVMUsage -Location $loc.DisplayName | ? {$_.Name.Value -eq "virtualMachines"} | Select currentvalue }or a tiny script like this which gives you the result per region
$myloc = Get-AzureRmLocation | select DisplayName $result = @() foreach($loc in $myloc) { $CoreAmount = Get-AzureRmVMUsage -Location $loc.DisplayName | where {$_.Name.Value -eq "virtualMachines"} | select currentvalue $obj = New-Object -Type PSCustomObject -Property @{ Location = $loc.Displayname VMCores = $CoreAmount.CurrentValue } $result += $obj } $resultwhich gives you this result
Sorry, the comment form is closed at this time.