I am trying to create a VM with a playbook like this:



  - name: Create VM
      resource_group: AnsibleResourcEGroup
      name: AnsibleVM
      vm_size: Standard_D4s_v3


When I run the playbook, this "Create VM" task fails:

fatal: [localhost]: FAILED! => {
  "changed": false, 
  "msg": "Error creating or updating virtual machine AnsibleVM - Azure Error: SkuNotAvailable\nMessage: The requested size for resource '/subscriptions/some-subscription-id/resourceGroups/some-resource-group-name/providers/Microsoft.Compute/virtualMachines/AnsibleVM' is currently not available in location 'region-name' zones '' for subscription 'some-subscription-id'. Please try another size or deploy to a different location or zones. See https://aka.ms/azureskunotavailable for details."

However, when I use az cli to enquery for the available vm size, the size Standard_D4s_v3 seems available:

$ az vm list-skus --location region-id --size Standard_D --output table

ResourceType     Locations    Name                Zones    Capabilities                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        Restrictions
---------------  -----------  ------------------  -------  --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------  --------------


virtualMachines  region-id    Standard_D2s_v3     1,2,3    ['MaxResourceVolumeMB=16384', 'OSVhdSizeMB=1047552', 'vCPUs=2', 'HyperVGenerations=V1,V2', 'MemoryGB=8', 'MaxDataDiskCount=4', 'LowPriorityCapable=True', 'PremiumIO=True', 'vCPUsAvailable=2', 'ACUs=160', 'vCPUsPerCore=2', 'CombinedTempDiskAndCachedIOPS=4000', 'CombinedTempDiskAndCachedReadBytesPerSecond=33554432', 'CombinedTempDiskAndCachedWriteBytesPerSecond=33554432', 'CachedDiskBytes=53687091200', 'UncachedDiskIOPS=3200', 'UncachedDiskBytesPerSecond=50331648', 'EphemeralOSDiskSupported=True', 'AcceleratedNetworkingEnabled=False', 'RdmaEnabled=False', 'MaxNetworkInterfaces=2']                                           None
virtualMachines  region-id    Standard_D4s_v3     1,2,3    ['MaxResourceVolumeMB=32768', 'OSVhdSizeMB=1047552', 'vCPUs=4', 'HyperVGenerations=V1,V2', 'MemoryGB=16', 'MaxDataDiskCount=8', 'LowPriorityCapable=True', 'PremiumIO=True', 'vCPUsAvailable=4', 'ACUs=160', 'vCPUsPerCore=2', 'CombinedTempDiskAndCachedIOPS=8000', 'CombinedTempDiskAndCachedReadBytesPerSecond=67108864', 'CombinedTempDiskAndCachedWriteBytesPerSecond=67108864', 'CachedDiskBytes=107374182400', 'UncachedDiskIOPS=6400', 'UncachedDiskBytesPerSecond=100663296', 'EphemeralOSDiskSupported=True', 'AcceleratedNetworkingEnabled=True', 'RdmaEnabled=False', 'MaxNetworkInterfaces=2']                                         None
virtualMachines  region-id    Standard_D8s_v3     1,2,3    ['MaxResourceVolumeMB=65536', 'OSVhdSizeMB=1047552', 'vCPUs=8', 'HyperVGenerations=V1,V2', 'MemoryGB=32', 'MaxDataDiskCount=16', 'LowPriorityCapable=True', 'PremiumIO=True', 'vCPUsAvailable=8', 'ACUs=160', 'vCPUsPerCore=2', 'CombinedTempDiskAndCachedIOPS=16000', 'CombinedTempDiskAndCachedReadBytesPerSecond=134217728', 'CombinedTempDiskAndCachedWriteBytesPerSecond=134217728', 'CachedDiskBytes=214748364800', 'UncachedDiskIOPS=12800', 'UncachedDiskBytesPerSecond=201326592', 'EphemeralOSDiskSupported=True', 'AcceleratedNetworkingEnabled=True', 'RdmaEnabled=False', 'MaxNetworkInterfaces=4']                                    None


which does not seems right.

So which part of my understanding wrong? How should I make sure that a VM size is available in my region?


There are a couple of possibilities based upon my experience:

  1. You may not have specified region-id in Ansible, which means it will default to the region of the Resource Group. Thus you may have a Resource Group in a region that does in-fact not support Standard_D4s_v3.

  2. From time to time specific instance types are unavailable in a region due to resource constraints from Azure, this is usually a temporary state, so trying again in a few hours will work.

  3. limits or quotas on your subscription might be preventing you from creating the Virtual Machine, although I would expect that you would get a different, more descriptive error message if this were the case.

  • 1
    I was going to provide an answer along the lines of using azure_rm_resourcegroup_info module to gather facts about the resource group to filter on, but I wasn't sure if this was a valid approach. If it were, perhaps this approach could be added to the answer? – Bruce Becker Nov 4 '19 at 14:39
  • @BruceBecker I think that's a perfectly valid answer in its own right, probably a better answer in the long run as it's impervious to whatever root cause is a problem. – Richard Slater Nov 4 '19 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.