Share via


The platform image 'MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:latest' is not available. Verify that all fields in the storage profile are correct.

Question

Thursday, August 11, 2016 7:40 PM

Hi,

I am trying to deploy an ARM template to provision multiple VMs. During deployment, I am getting this strange error:

It is indeed affecting only the last VM provisioned using this template:

For reference, here is the relevant part of the ARM template that I deployed:

{
      "dependsOn": [
        "[concat('Microsoft.Network/networkInterfaces/', 'vmTest3Car', padLeft(copyindex(1),2,'0'), 'nic1')]",
        "[concat('Microsoft.Compute/availabilitySets/', 'testAvailabilitySet1')]"
      ],
      "properties": {
        "storageProfile": {
          "imageReference": {
            "publisher": "MicrosoftWindowsServer",
            "version": "latest",
            "offer": "WindowsServer",
            "sku": "2012-R2-Datacenter"
          },
          "osDisk": {
            "vhd": {
              "uri": "[concat('http://','<storageaccountnameplaceholder>',padLeft(copyindex(1),2,'0'),'.blob.core.windows.net/vhds/','vmTest3Car', padLeft(copyindex(1),2,'0'), 'osdisk.vhd')]"
            },
            "createOption": "FromImage",
            "name": "[concat('vmTest3Car', padLeft(copyindex(1),2,'0'), 'osdisk')]",
            "caching": "ReadWrite"
          }
        },
        "networkProfile": {
          "networkInterfaces": [
            {
              "id": "[resourceId('Microsoft.Network/networkInterfaces',concat('vmTest3Car', padLeft(copyindex(1),2,'0'), 'nic1'))]"
            }
          ]
        },
        "osProfile": {
          "adminPassword": "[parameters('adminPassword')]",
          "computername": "[concat('vmTest3Car', padLeft(copyindex(1),2,'0'))]",
          "adminUsername": "AzrRootAdminUser"
        },
        "hardwareProfile": {
          "vmSize": "Standard_A1"
        },
        "availabilitySet": {
          "id": "[resourceId('Microsoft.Compute/availabilitySets', 'testAvailabilitySet1')]"
        }
      },
      "apiVersion": "2015-06-15",
      "tags": {
        "CreationDate": "08-11-2016",
        "Department": "TestDepartment",
        "Owner": "TestOwner"
      },
      "location": "East US 2",
      "type": "Microsoft.Compute/virtualMachines",
      "name": "[concat('vmTest3Car', padLeft(copyindex(1),2,'0'))]",
      "copy": {
        "count": "[parameters('numberOfInstances')]",
        "name": "virtualMachineLoop"
      }
    },

Furthermore, here is part of the object for a VM that succeeded:

OSProfile                  : 
  ComputerName             : vmTest3Car03
  AdminUsername            : AzrRootAdminUser
  WindowsConfiguration     : 
    ProvisionVMAgent       : True
    EnableAutomaticUpdates : True
ProvisioningState          : Succeeded
StorageProfile             : 
  ImageReference           : 
    Publisher              : MicrosoftWindowsServer
    Offer                  : WindowsServer
    Sku                    : 2012-R2-Datacenter
    Version                : latest
  OsDisk                   : 
    OsType                 : Windows
    Name                   : vmTest3Car03osdisk
    Vhd                    : 
      Uri                  : http://<placeholderstoragename>.blob.core.windows.net/vhds/vmTest3Car03osdisk.vhd
    Caching                : ReadWrite
    CreateOption           : FromImage
NetworkInterfaceIDs[0]     : /subscriptions/43955c27-bbb7-4f49-8528-df0163f11a18/resourceGroups/powershellLearning/providers/Microsoft.Network/networkInterfaces/vmTest3Car03nic1

And the same part of the object for the VM that failed:

OSProfile                  : 
  ComputerName             : vmTest3Car04
  AdminUsername            : AzrRootAdminUser
  WindowsConfiguration     : 
    ProvisionVMAgent       : True
    EnableAutomaticUpdates : True
ProvisioningState          : Failed
StorageProfile             : 
  ImageReference           : 
    Publisher              : MicrosoftWindowsServer
    Offer                  : WindowsServer
    Sku                    : 2012-R2-Datacenter
    Version                : latest
  OsDisk                   : 
    OsType                 : Windows
    Name                   : vmTest3Car04osdisk
    Vhd                    : 
      Uri                  : http://<placeholderstoragename>.blob.core.windows.net/vhds/vmTest3Car04osdisk.vhd
    Caching                : ReadWrite
    CreateOption           : FromImage
NetworkInterfaceIDs[0]     : /subscriptions/43955c27-bbb7-4f49-8528-df0163f11a18/resourceGroups/powershellLearning/providers/Microsoft.Network/networkInterfaces/vmTest3Car04nic1

The storage profiles for both VMs are identical!

What is going on?

All replies (3)

Monday, August 15, 2016 5:57 PM âś…Answered

The storage profile does not refer to the account created for your deployment in the resource group. As evidenced by the ARM Template definition of the VM resource, the Storage profile is defined at the time of VM creation, and is particular to each VM.

Anyway, obviously the error was a weird one, because, how is Windows Server 2012 R2 not going to be an available image from the gallery? Deleting the storage account in which the VM was being deployed, recreating the storage account, and redeploying the VM fixed the issue. Still have no idea what the root cause of the issue was.


Friday, August 12, 2016 12:52 PM

Hello Charlie,

Are you using an MSDN subscription to use Azure? If so then you might need to check you have sufficient credits in your account. I believe a Storage profile would refer to the account created for your deployment in the resource group. This is why they appear to be the same for the 2 VMs. Did you check the profiles for the first 2 VM which have been deployed successfully? Are they the same as well.

Regards,

Loydon


Wednesday, September 7, 2016 7:00 PM

the root cause is most likely your storage account is not in the same region as your VM. I just had this issue and noticed that I had selected the wrong storage account. when deploying to a storage account in the same region, no errors and not changes to the ARM template were required.