sivakolisetti / test

0 stars 0 forks source link

Failed to find temporary OS disk on VM in packer with azure #1

Open sivakolisetti opened 2 years ago

sivakolisetti commented 2 years ago

{ "builders": [{ "type": "azure-arm", "client_id": "9799262d-6ef6-426c-bbec-1899f09d8207", "client_secret": "l558Q~TQFkcReZ9AVAbmElS9Qzseenz25f_TnbcR", "subscription_id": "f7e798a6-8fd2-4799-8302-cbffa03bb9a7", "managed_image_resource_group_name": "Test-RG", "managed_image_name": "myPackerImage-new",

  "os_type": "Windows",
  "image_publisher": "MicrosoftWindowsDesktop",
  "image_offer": "Windows-10",
  "image_sku": "20h2-pro-g2",
  "image_version" :"latest",

  "azure_tags": {
      "dept": "ECAD",
      "task": "Image deployment"
  },

  "location": "westeurope",
  "vm_size": "Standard_DS2_v2"
}],

"provisioners": [{
    "type": "powershell",
    "inline": [
      "Add-WindowsFeature Web-Server",
      "& $env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /quiet /quit",
      "while($true) { $imageState = Get-ItemProperty HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Setup\\State | Select ImageState; if($imageState.ImageState -ne 'IMAGE_STATE_GENERALIZE_RESEAL_TO_OOBE') { Write-Output $imageState.ImageState; Start-Sleep -s 10  } else { break } }"
    ]
  }]

}

sivakolisetti commented 2 years ago

behavior is please check the below

==> azure-arm: ==> azure-arm: Attempting deletion -> Microsoft.Network/networkInterfaces : 'pkrnik0fa3djnzo' ==> azure-arm: Attempting deletion -> Microsoft.Network/publicIPAddresses : 'pkripk0fa3djnzo' ==> azure-arm: Deleting -> Microsoft.Compute/disks : '/subscriptions/f7e798a6-8fd2-4799-8302-cbffa03bb9a7/resourceGroups/pkr-Resource-Group-k0fa3djnzo/providers/Microsoft.Compute/disks/pkrosk0fa3djnzo' ==> azure-arm: Removing the created Deployment object: 'pkrdpk0fa3djnzo' ==> azure-arm: ==> azure-arm: Deleting individual resources ... ==> azure-arm: Adding to deletion queue -> Microsoft.KeyVault/vaults/secrets : 'pkrkvk0fa3djnzo/packerKeyVaultSecret' ==> azure-arm: Adding to deletion queue -> Microsoft.KeyVault/vaults : 'pkrkvk0fa3djnzo' ==> azure-arm: Waiting for deletion of all resources... ==> azure-arm: Attempting deletion -> Microsoft.KeyVault/vaults : 'pkrkvk0fa3djnzo' ==> azure-arm: Attempting deletion -> Microsoft.KeyVault/vaults/secrets : 'pkrkvk0fa3djnzo/packerKeyVaultSecret' ==> azure-arm: Failed to find temporary OS disk on VM. Please delete manually. ==> azure-arm: ==> azure-arm: VM Name: pkrvmk0fa3djnzo ==> azure-arm: Error: %!s() ==> azure-arm: ==> azure-arm: Cleanup requested, deleting resource group ... ==> azure-arm: ==> azure-arm: Not waiting for Resource Group delete as requested by user. Resource Group Name is pkr-Resource-Group-k0fa3djnzo Build 'azure-arm' errored after 13 minutes 8 seconds: Timeout waiting for WinRM.

==> Wait completed after 13 minutes 8 seconds

==> Some builds didn't complete successfully and had errors: