Badgerati / Fogg

PowerShell tool to aide and simplify the creation, deployment and provisioning of infrastructure in Azure
MIT License
7 stars 2 forks source link

During validation, ensure the VM sizes core count don't exceed the Max Core limit #22

Closed Badgerati closed 7 years ago

Badgerati commented 7 years ago

During validation, ensure the VM sizes core count don't exceed the Max Core limit.

To get the max core limit:

(Get-AzureRmVMUsage -Location 'westeurope' | ? { $_.Name.Value -ieq 'cores' }).CurrentValue
(Get-AzureRmVMUsage -Location 'westeurope' | ? { $_.Name.Value -ieq 'cores' }).Limit

To get the number of cores a VM size type requires:

(Get-AzureRmVMSize -Location 'westeurope' | ? { $_.Name -ieq 'Standard_DS5_v2' }).NumberOfCores

If what is about to be deployed exceeds the limit during initial validation, fail. So we don't have to deploy everything and wait hours before it fails.