Azure SkuNotAvailable during Terraform apply

I ran into some issues when actually attempting to apply my first Terraform template, specifically errors related to the location I had chosen:

* azurerm_virtual_machine.test: compute.VirtualMachinesClient#CreateOrUpdate:
Failure sending request: StatusCode=409 -- 
Original Error: failed request: autorest/azure: Service returned an error. 
Status=<nil> Code="SkuNotAvailable" 
Message="The requested size for resource '/subscriptions/f745d13d/resourceGroups/HelloWorld/providers/Microsoft.Compute/virtualMachines/helloworld' is currently not available in location 'WestUS' zones '' for subscription 'f745d13d'. 
Please try another size or deploy to a different location or zones. 
See for details."

This didn’t make much sense to me, because I was using a very normal VM size (like Standard_A2 or something) and it was definitely available in WestUS.

The key to solving was when I use the Azure Shell (powershell) to run this:

Get-AzureRmComputeResourceSku | where {$_.Locations.Contains("WestUS")}

The output of this command:

Displays azure locations for my subscription

Turns out for my Subscription (Visual Studio Enterprise – MPN), WestUS is restricted to very few VM sizes (note the “NotAvailableForSubscription” items). When I target WestUS2 or EastUS, then there’s quite a bit more choice.

2 thoughts to “Azure SkuNotAvailable during Terraform apply”

  1. Do you know the azure cli equivalent of the command

    Get-AzureRmComputeResourceSku | where {$_.Locations.Contains(“WestUS”)}

    I have already tried
    az vm list-skus –output table –location uksouth
    but it doesn’t return the restrictions. This is the output
    ResourceType Locations Name Capabilities Tier Size
    —————- ———– ———————- ———————————————————————————————————————————————————————————————– ——– ————-
    availabilitySets uksouth Classic MaximumPlatformFaultDomainCount=3
    availabilitySets uksouth Aligned MaximumPlatformFaultDomainCount=2
    disks uksouth Standard_LRS Standard
    disks uksouth Premium_LRS Premium
    snapshots uksouth Standard_LRS Standard
    snapshots uksouth Premium_LRS Premium
    virtualMachines uksouth Standard_B1ms [‘MaxResourceVolumeMB=4096’, ‘OSVhdSizeMB=1047552’, ‘vCPUs=1’, ‘MemoryGB=2’, ‘MaxDataDiskCount=2’, ‘LowPriorityCapable=False’, ‘PremiumIO=True’] Standard B1ms
    virtualMachines uksouth Standard_B1s [‘MaxResourceVolumeMB=2048’, ‘OSVhdSizeMB=1047552’, ‘vCPUs=1’, ‘MemoryGB=1’, ‘MaxDataDiskCount=2’, ‘LowPriorityCapable=False’, ‘PremiumIO=True’] Standard B1s
    virtualMachines uksouth Standard_B2ms [‘MaxResourceVolumeMB=16384’, ‘OSVhdSizeMB=1047552’, ‘vCPUs=2’, ‘MemoryGB=8’, ‘MaxDataDiskCount=4’, ‘LowPriorityCapable=False’, ‘PremiumIO=True’] Standard B2ms
    virtualMachines uksouth Standard_B2s [‘MaxResourceVolumeMB=8192’, ‘OSVhdSizeMB=1047552’, ‘vCPUs=2’, ‘MemoryGB=4’, ‘MaxDataDiskCount=4’, ‘LowPriorityCapable=False’, ‘PremiumIO=True’] Standard B2s
    virtualMachines uksouth Standard_B4ms [‘MaxResourceVolumeMB=32768’, ‘OSVhdSizeMB=1047552’, ‘vCPUs=4’, ‘MemoryGB=16’, ‘MaxDataDiskCount=8’, ‘LowPriorityCapable=False’, ‘PremiumIO=True’] Standard B4ms
    virtualMachines uksouth Standard_B8ms [‘MaxResourceVolumeMB=65536’, ‘OSVhdSizeMB=1047552’, ‘vCPUs=8’, ‘MemoryGB=32’, ‘MaxDataDiskCount=16’, ‘LowPriorityCapable=False’, ‘PremiumIO=True’] Standard B8ms
    virtualMachines uksouth Standard_A0 [‘MaxResourceVolumeMB=20480’, ‘OSVhdSizeMB=1047552’, ‘vCPUs=1’, ‘MemoryGB=0.75’, ‘MaxDataDiskCount=1’, ‘LowPriorityCapable=False’, ‘PremiumIO=False’] Standard A0
    virtualMachines uksouth Standard_A1 [‘MaxResourceVolumeMB=71680’, ‘OSVhdSizeMB=1047552’, ‘vCPUs=1’, ‘MemoryGB=1.75’, ‘MaxDataDiskCount=2’, ‘LowPriorityCapable=True’, ‘PremiumIO=False’] Standard A1
    virtualMachines uksouth Standard_A2 [‘MaxResourceVolumeMB=138240’, ‘OSVhdSizeMB=1047552’, ‘vCPUs=2’, ‘MemoryGB=3.5’, ‘MaxDataDiskCount=4’, ‘LowPriorityCapable=True’, ‘PremiumIO=False’] Standard A2
    virtualMachines uksouth Standard_A3 [‘MaxResourceVolumeMB=291840’, ‘OSVhdSizeMB=1047552’, ‘vCPUs=4’, ‘MemoryGB=7’, ‘MaxDataDiskCount=8’, ‘LowPriorityCapable=True’, ‘PremiumIO=False’] Standard A3

    1. Imran, can you try with this syntax:

      az vm list-skus --location uksouth --output table

      I ran this from the Azure Shell, and it produced output for me like this (East US):
      virtualMachines eastus Standard_DS15_v2 [‘MaxResourceVolumeMB=286720’, ‘OSVhdSizeMB=1047552’, ‘vCPUs=20’, ‘MemoryGB=140’, ‘MaxDataDiskCount=64’, ‘LowPriorityCapable=True’, ‘PremiumIO=True’] Standard DS15_v2 None

      virtualMachines eastus Standard_DS2_v2_Promo [‘MaxResourceVolumeMB=14336’, ‘OSVhdSizeMB=1047552’, ‘vCPUs=2’, ‘MemoryGB=7’, ‘MaxDataDiskCount=8’, ‘LowPriorityCapable=False’, ‘PremiumIO=True’] Standard DS2_v2_Promo NotAvailableForSubscription

      virtualMachines eastus Standard_DS3_v2_Promo [‘MaxResourceVolumeMB=28672’, ‘OSVhdSizeMB=1047552’, ‘vCPUs=4’, ‘MemoryGB=14’, ‘MaxDataDiskCount=16’, ‘LowPriorityCapable=False’, ‘PremiumIO=True’] Standard DS3_v2_Promo NotAvailableForSubscription

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.