1

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

  tasks:

  ...

  - name: Create VM
    azure_rm_virtualmachine:
      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?

Bruce Becker
  • 3,783
  • 4
  • 20
  • 41
Koala Yeung
  • 113
  • 5

1 Answers1

2

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.

Richard Slater
  • 11,747
  • 7
  • 43
  • 82