Azure PowerShell: Get Amount of VM Cores per Region - Sebastian Gräf
4227
post-template-default,single,single-post,postid-4227,single-format-standard,cookies-not-set,ajax_fade,page_not_loaded,,side_area_uncovered_from_content,qode-theme-ver-15.0,qode-theme-bridge,wpb-js-composer js-comp-ver-5.4.7,vc_responsive
 

Azure PowerShell: Get Amount of VM Cores per Region

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
}
$result

which gives you this result

No Comments

Sorry, the comment form is closed at this time.

%d bloggers like this: