Public/Get-FMTVMSize.ps1
function Get-FMTVMSize { param( [Parameter(Mandatory)] [string]$Location ) $session = New-FMTSession if (!$session) { $message = '-- stopping --' return $message } # Check that the location exists. $locale = Get-AzLocation | Where-Object {$_.location -eq $Location} if (!$locale) { $errormsg = "-- Please check specified location and try again --" return $errormsg | Write-Error } $badArray = @() $response = Get-AzComputeResourceSku -Location $Location | Where-Object {$_.Name -eq 'Standard_D64s_v5' -or $_.Name -eq 'Standard_L8s_v3'} $badResources = ($response | Where-Object {$_.Restrictions}) foreach ($r in $badResources) { $o = New-Object psobject $o | Add-Member -MemberType NoteProperty -Name "Location" -Value $r.LocationInfo.Location $o | Add-Member -MemberType NoteProperty -Name "VM Size" -Value $r.name $o | Add-Member -MemberType NoteProperty -Name "Restriction" -Value $r.Restrictions.reasoncode $o | Add-Member -MemberType NoteProperty -Name "Zones" -Value $r.Restrictions.RestrictionInfo.Zones $badArray += $o } if ($badArray) { return $badArray } else { # return "-- No restrictions reported --" } } |