简体   繁体   中英

"DiskImageNotReady" error when creating VM in Azure using ARM template and JSON

I am trying to deploy 3 azure Ubuntu vm's using an ARM template. They are being deployed as part of a larger infrastructure deployment of resource groups, storage accounts, SQL servers etc. Everything is working great apart from the VM creation. During testing with a single VM the script worked but with 3 I get the following error -

    New-AzureRmResourceGroupDeployment : 16:52:57 - Resource Microsoft.Compute/virtualMachines 'xxxV3Monitor1' failed with message '{
  "status": "Failed",
  "error": {
    "code": "ResourceDeploymentFailure",
    "message": "The resource operation completed with terminal provisioning state 'Failed'.",
    "details": [
      {
        "code": "DiskImageNotReady",
        "message": "Disk image https://xxxxxx.blob.core.windows.net/rootvhd/v1ubuntudocker.vhd is in Pending state. Please retry when image is ready."
      }

It seems the custom root VHD image we a re using is failing due to be in a "Pending" state, i assume this is some lock on the file as it is being used to create one of the other VMs?

Any help much appreciated. Thanks.

I'm assuming that you are moving the VM image prior to creating the VM's from it. If so try this code after the move, and before you start the deployment script: ($blob1 is the variable that you call the Start-AzureStorageBlobCopy command)

### Retrieve the current status of the copy operation ###
$status = $blob1 | Get-AzureStorageBlobCopyState 

### Print out status ### 
$status 

### Loop until complete ###                                    
While($status.Status -eq "Pending"){
  $status = $blob1 | Get-AzureStorageBlobCopyState 
  Start-Sleep -s 60
  ### Print out status ###
  $status
}

This will cycle each minute updating with the status.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM