Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key Vaule is not deleted on cleanup azure-arm #8493

Closed
KlutzyBubbles opened this issue Dec 17, 2019 · 10 comments · Fixed by #8905
Closed

Key Vaule is not deleted on cleanup azure-arm #8493

KlutzyBubbles opened this issue Dec 17, 2019 · 10 comments · Fixed by #8905
Assignees
Labels
Milestone

Comments

@KlutzyBubbles
Copy link

When filing a bug, please include the following headings if possible. Any
example text in this template can be deleted.

Overview of the Issue

When using the azure-arm provisioner with build_resource_group_name, the key vault resource isn't deleted at cleanup

Reproduction Steps

See overview

Packer version

1.4.5 and 1.4.4

Operating system and Environment details

OS, Architecture, and any other information you can provide about the
environment.

Windows Server 2019, 64x, Nothing has been installed on these machines bar packer

Log Fragments and crash.log files

I was unable to set env variables as the machines are locked down. But the console output lists the keyvault as one of the resources to delete but doesnt do anything. No delete request within azure, nothing blocking the subscription or resource group from deleting resources etc.

@jghal
Copy link

jghal commented Feb 17, 2020

Am seeing the same with Packer 1.5.2

2020-02-17T19:40:23Z: ==> azure-arm:  -> Deployment Resources within: kvpkrdpzbso77le0h
2020-02-17T19:40:23Z: ==> azure-arm:  -> Microsoft.KeyVault/vaults/secrets : 'pkrkvzbso77le0h/packerKeyVaultSecret'
2020-02-17T19:40:23Z: ==> azure-arm:  -> Microsoft.KeyVault/vaults : 'pkrkvzbso77le0h'
2020-02-17T19:40:23Z: ==> azure-arm:  ->  : ''
2020-02-17T19:40:23Z: ==> azure-arm: Error deleting resource.  Please delete manually.
==> azure-arm: 
==> azure-arm: Name: 
==> azure-arm: Error: Unable to parse path of image
2020-02-17T19:40:23Z: ==> azure-arm: Removing the created Deployment object: 'kvpkrdpzbso77le0h'
2020-02-17T19:41:08Z: ==> azure-arm:

@nywilken
Copy link
Contributor

@jghal thanks for reaching out on this issue. I'm having a little trouble correlating the provided errors to the key vault cleanup issue. Are you able to share a full debug log output stripped of any sensitive information PACKER_LOG=1 PACKER_LOG_PATH=out.log packer build build.json and a simplified build configuration file for reproducing the problem?

@jghal
Copy link

jghal commented Feb 18, 2020

@nywilken will try but will probably be a few days before I can get it.

@jghal
Copy link

jghal commented Feb 25, 2020

So I'm only seeing that error when the image build has failed for some other reason. For example using VM size Standard_D2s_v3 and I hit the issue where WinRM doesn't self-configure correctly and the packer build times out. When I change the VM size to D8s and the build is successful, I don't see the error I posted but I do see the KeyVault left behind. Interestingly, I not only don't see the error, I don't see any lines relating to KeyVault during the destroy.

Error when build is already failed, with KeyVault listed in resources to destroy

==> azure-arm: The resource group was not created by Packer, deleting individual resources ...
==> azure-arm:  -> Deployment Resources within: pkrdp05q2cv0v49
==> azure-arm:  -> Microsoft.Compute/virtualMachines : 'pkrvm05q2cv0v49'
==> azure-arm:  -> Microsoft.Network/networkInterfaces : 'pkrni05q2cv0v49'
==> azure-arm:  -> Microsoft.Compute/disks : '/subscriptions/<subscription id>/resourceGroups/COTEST-R1P2-PACKER/providers/Microsoft.Compute/disks/pkros05q2cv0v49'
==> azure-arm: Removing the created Deployment object: 'pkrdp05q2cv0v49'
==> azure-arm: 
==> azure-arm: The resource group was not created by Packer, deleting individual resources ...
==> azure-arm: Could not retrieve OS Image details
==> azure-arm:  -> Deployment Resources within: kvpkrdp05q2cv0v49
==> azure-arm:  -> Microsoft.KeyVault/vaults/secrets : 'pkrkv05q2cv0v49/packerKeyVaultSecret'
==> azure-arm:  -> Microsoft.KeyVault/vaults : 'pkrkv05q2cv0v49'
==> azure-arm:  ->  : ''
==> azure-arm: Error deleting resource.  Please delete manually.
==> azure-arm: 
==> azure-arm: Name: 
==> azure-arm: Error: Unable to parse path of image
==> azure-arm: Removing the created Deployment object: 'kvpkrdp05q2cv0v49'

KeyVault not listed in resources to destroy when build otherwise succeeded

==> azure-arm: The resource group was not created by Packer, only deleting individual resources ...
==> azure-arm:  -> Microsoft.Compute/virtualMachines : 'pkrvmk8on9b91gf'
==> azure-arm:  -> Microsoft.Network/networkInterfaces : 'pkrnik8on9b91gf'
==> azure-arm: Deleting the temporary OS disk ...
==> azure-arm:  -> OS Disk : '/subscriptions/<subscription id>/resourceGroups/COTEST-R1P2-PACKER/providers/Microsoft.Compute/disks/pkrosk8on9b91gf'
==> azure-arm: Deleting the temporary Additional disk ...
==> azure-arm: Removing the created Deployment object: 'pkrdpk8on9b91gf'
==> azure-arm: Removing the created Deployment object: 'kvpkrdpk8on9b91gf'

In both cases the KeyVault is still present in the resource group. Here's the debug log that follows the "resource group was not created by Packer" message in the successful build

==> azure-arm: The resource group was not created by Packer, only deleting individual resources ...�[0m
2020/02/25 19:13:49 packer-builder-azure-arm plugin: Azure request method="GET" request="https://management.azure.com/subscriptions/<subscription>/resourcegroups/cotest-r1p2-packer/deployments/pkrdpk8on9b91gf/operations?%24top=50&api-version=2018-02-01" body=""
2020/02/25 19:13:49 packer-builder-azure-arm plugin: Azure response status="200 OK" method="GET" request="https://management.azure.com/subscriptions/<subscription>/resourcegroups/cotest-r1p2-packer/deployments/pkrdpk8on9b91gf/operations?%24top=50&api-version=2018-02-01" x-ms-request-id="83c1ad61-1ebf-4eab-aef1-f3b37226d5bd" body="{\"value\":[{\"id\":\"/subscriptions/<subscription>/resourceGroups/cotest-r1p2-packer/providers/Microsoft.Resources/deployments/pkrdpk8on9b91gf/operations/11E28F16F8FFBDA0\",\"operationId\":\"11E28F16F8FFBDA0\",\"properties\":{\"provisioningOperation\":\"Create\",\"provisioningState\":\"Succeeded\",\"timestamp\":\"2020-02-25T19:07:01.5440128Z\",\"duration\":\"PT1M8.3552476S\",\"trackingId\":\"45e15c87-0053-47bd-9904-09ff0c3d4c75\",\"serviceRequestId\":\"b51be109-3db8-47a0-b307-dd1573672b6a\",\"statusCode\":\"OK\",\"targetResource\":{\"id\":\"/subscriptions/<subscription>/resourceGroups/cotest-r1p2-packer/providers/Microsoft.Compute/virtualMachines/pkrvmk8on9b91gf\",\"resourceType\":\"Microsoft.Compute/virtualMachines\",\"resourceName\":\"pkrvmk8on9b91gf\"}}},{\"id\":\"/subscriptions/<subscription>/resourceGroups/cotest-r1p2-packer/providers/Microsoft.Resources/deployments/pkrdpk8on9b91gf/operations/62CA34589713A47B\",\"operationId\":\"62CA34589713A47B\",\"properties\":{\"provisioningOperation\":\"Create\",\"provisioningState\":\"Succeeded\",\"timestamp\":\"2020-02-25T19:05:53.0411613Z\",\"duration\":\"PT1.8632416S\",\"trackingId\":\"91b096ba-4555-4d84-a232-9c8e0f00ef36\",\"serviceRequestId\":\"d5158aaf-f0b8-4019-bbb6-531f311fc4b2\",\"statusCode\":\"Created\",\"targetResource\":{\"id\":\"/subscriptions/<subscription>/resourceGroups/cotest-r1p2-packer/providers/Microsoft.Network/networkInterfaces/pkrnik8on9b91gf\",\"resourceType\":\"Microsoft.Network/networkInterfaces\",\"resourceName\":\"pkrnik8on9b91gf\"}}},{\"id\":\"/subscriptions/<subscription>/resourceGroups/cotest-r1p2-packer/providers/Microsoft.Resources/deployments/pkrdpk8on9b91gf/operations/08586189493352675377\",\"operationId\":\"08586189493352675377\",\"properties\":{\"provisioningOperation\":\"EvaluateDeploymentOutput\",\"provisioningState\":\"Succeeded\",\"timestamp\":\"2020-02-25T19:07:02.0931116Z\",\"duration\":\"PT0.2223954S\",\"trackingId\":\"b53dbdb1-e01e-4935-9e4d-050ab62a60ca\",\"statusCode\":\"OK\",\"statusMessage\":null}}]}"
2020/02/25 19:13:49 packer-builder-azure-arm plugin: Azure response status="200 OK" method="GET" request="https://management.azure.com/subscriptions/<subscription>/resourcegroups/cotest-r1p2-packer/deployments/pkrdpk8on9b91gf/operations?%24top=50&api-version=2018-02-01" x-ms-request-id="83c1ad61-1ebf-4eab-aef1-f3b37226d5bd" body="{\"value\":[{\"id\":\"/subscriptions/<subscription>/resourceGroups/cotest-r1p2-packer/providers/Microsoft.Resources/deployments/pkrdpk8on9b91gf/operations/11E28F16F8FFBDA0\",\"operationId\":\"11E28F16F8FFBDA0\",\"properties\":{\"provisioningOperation\":\"Create\",\"provisioningState\":\"Succeeded\",\"timestamp\":\"2020-02-25T19:07:01.5440128Z\",\"duration\":\"PT1M8.3552476S\",\"trackingId\":\"45e15c87-0053-47bd-9904-09ff0c3d4c75\",\"serviceRequestId\":\"b51be109-3db8-47a0-b307-dd1573672b6a\",\"statusCode\":\"OK\",\"targetResource\":{\"id\":\"/subscriptions/<subscription>/resourceGroups/cotest-r1p2-packer/providers/Microsoft.Compute/virtualMachines/pkrvmk8on9b91gf\",\"resourceType\":\"Microsoft.Compute/virtualMachines\",\"resourceName\":\"pkrvmk8on9b91gf\"}}},{\"id\":\"/subscriptions/<subscription>/resourceGroups/cotest-r1p2-packer/providers/Microsoft.Resources/deployments/pkrdpk8on9b91gf/operations/62CA34589713A47B\",\"operationId\":\"62CA34589713A47B\",\"properties\":{\"provisioningOperation\":\"Create\",\"provisioningState\":\"Succeeded\",\"timestamp\":\"2020-02-25T19:05:53.0411613Z\",\"duration\":\"PT1.8632416S\",\"trackingId\":\"91b096ba-4555-4d84-a232-9c8e0f00ef36\",\"serviceRequestId\":\"d5158aaf-f0b8-4019-bbb6-531f311fc4b2\",\"statusCode\":\"Created\",\"targetResource\":{\"id\":\"/subscriptions/<subscription>/resourceGroups/cotest-r1p2-packer/providers/Microsoft.Network/networkInterfaces/pkrnik8on9b91gf\",\"resourceType\":\"Microsoft.Network/networkInterfaces\",\"resourceName\":\"pkrnik8on9b91gf\"}}},{\"id\":\"/subscriptions/<subscription>/resourceGroups/cotest-r1p2-packer/providers/Microsoft.Resources/deployments/pkrdpk8on9b91gf/operations/08586189493352675377\",\"operationId\":\"08586189493352675377\",\"properties\":{\"provisioningOperation\":\"EvaluateDeploymentOutput\",\"provisioningState\":\"Succeeded\",\"timestamp\":\"2020-02-25T19:07:02.0931116Z\",\"duration\":\"PT0.2223954S\",\"trackingId\":\"b53dbdb1-e01e-4935-9e4d-050ab62a60ca\",\"statusCode\":\"OK\",\"statusMessage\":null}}]}"
2020/02/25 19:13:49 ui: �[1;32m==> azure-arm:  -> Microsoft.Compute/virtualMachines : 'pkrvmk8on9b91gf'�[0m
2020/02/25 19:13:49 packer-builder-azure-arm plugin: Azure request method="DELETE" request="https://management.azure.com/subscriptions/<subscription>/resourceGroups/cotest-r1p2-packer/providers/Microsoft.Compute/virtualMachines/pkrvmk8on9b91gf?api-version=2018-04-01" body=""
2020/02/25 19:13:49 packer-builder-azure-arm plugin: Azure response request="https://management.azure.com/subscriptions/<subscription>/resourceGroups/cotest-r1p2-packer/providers/Microsoft.Compute/virtualMachines/pkrvmk8on9b91gf?api-version=2018-04-01" x-ms-request-id="59b8ad9b-eb06-4b4a-ae1b-600a327ff865" body="" status="202 Accepted" method="DELETE"
2020/02/25 19:13:49 packer-builder-azure-arm plugin: Azure request method="GET" request="https://management.azure.com/subscriptions/<subscription>/providers/Microsoft.Compute/locations/southcentralus/operations/59b8ad9b-eb06-4b4a-ae1b-600a327ff865?api-version=2018-04-01" body=""
2020/02/25 19:13:49 packer-builder-azure-arm plugin: Azure response method="GET" request="https://management.azure.com/subscriptions/<subscription>/providers/Microsoft.Compute/locations/southcentralus/operations/59b8ad9b-eb06-4b4a-ae1b-600a327ff865?api-version=2018-04-01" x-ms-request-id="b931162c-957a-4fcd-9db8-1dc86a029c55" body="{\r\n  \"startTime\": \"2020-02-25T19:13:49.7173596+00:00\",\r\n  \"status\": \"InProgress\",\r\n  \"name\": \"59b8ad9b-eb06-4b4a-ae1b-600a327ff865\"\r\n}" status="200 OK"
2020/02/25 19:14:19 packer-builder-azure-arm plugin: Azure request method="GET" request="https://management.azure.com/subscriptions/<subscription>/providers/Microsoft.Compute/locations/southcentralus/operations/59b8ad9b-eb06-4b4a-ae1b-600a327ff865?api-version=2018-04-01" body=""
2020/02/25 19:14:19 ui: �[1;32m==> azure-arm:  -> Microsoft.Network/networkInterfaces : 'pkrnik8on9b91gf'�[0m
2020/02/25 19:14:19 packer-builder-azure-arm plugin: Azure response body="{\r\n  \"startTime\": \"2020-02-25T19:13:49.7173596+00:00\",\r\n  \"endTime\": \"2020-02-25T19:14:00.358548+00:00\",\r\n  \"status\": \"Succeeded\",\r\n  \"name\": \"59b8ad9b-eb06-4b4a-ae1b-600a327ff865\"\r\n}" status="200 OK" method="GET" request="https://management.azure.com/subscriptions/<subscription>/providers/Microsoft.Compute/locations/southcentralus/operations/59b8ad9b-eb06-4b4a-ae1b-600a327ff865?api-version=2018-04-01" x-ms-request-id="dd539486-0c20-47be-9d48-7230f283baf3"
2020/02/25 19:14:19 packer-builder-azure-arm plugin: Azure request method="DELETE" request="https://management.azure.com/subscriptions/<subscription>/resourceGroups/cotest-r1p2-packer/providers/Microsoft.Network/networkInterfaces/pkrnik8on9b91gf?api-version=2018-01-01" body=""
2020/02/25 19:14:19 packer-builder-azure-arm plugin: Azure response request="https://management.azure.com/subscriptions/<subscription>/resourceGroups/cotest-r1p2-packer/providers/Microsoft.Network/networkInterfaces/pkrnik8on9b91gf?api-version=2018-01-01" x-ms-request-id="5d38965e-4037-4ee0-960a-a80ca3f83227" body="" status="202 Accepted" method="DELETE"
2020/02/25 19:14:19 packer-builder-azure-arm plugin: Azure request method="GET" request="https://management.azure.com/subscriptions/<subscription>/providers/Microsoft.Network/locations/southcentralus/operations/5d38965e-4037-4ee0-960a-a80ca3f83227?api-version=2018-01-01" body=""
2020/02/25 19:14:20 packer-builder-azure-arm plugin: Azure response status="200 OK" method="GET" request="https://management.azure.com/subscriptions/<subscription>/providers/Microsoft.Network/locations/southcentralus/operations/5d38965e-4037-4ee0-960a-a80ca3f83227?api-version=2018-01-01" x-ms-request-id="9fc2d73d-25e3-4c3b-b504-592040e023cc" body="{\r\n  \"status\": \"InProgress\"\r\n}"
2020/02/25 19:14:30 packer-builder-azure-arm plugin: Azure request method="GET" request="https://management.azure.com/subscriptions/<subscription>/providers/Microsoft.Network/locations/southcentralus/operations/5d38965e-4037-4ee0-960a-a80ca3f83227?api-version=2018-01-01" body=""
2020/02/25 19:14:30 packer-builder-azure-arm plugin: Azure response status="200 OK" method="GET" request="https://management.azure.com/subscriptions/<subscription>/providers/Microsoft.Network/locations/southcentralus/operations/5d38965e-4037-4ee0-960a-a80ca3f83227?api-version=2018-01-01" x-ms-request-id="93d3cf78-cab7-4fb4-8a54-6d004e4ec287" body="{\r\n  \"status\": \"Succeeded\"\r\n}"
2020/02/25 19:14:30 ui: �[1;32m==> azure-arm: Deleting the temporary OS disk ...�[0m
2020/02/25 19:14:30 ui: �[1;32m==> azure-arm:  -> OS Disk : '/subscriptions/<subscription>/resourceGroups/COTEST-R1P2-PACKER/providers/Microsoft.Compute/disks/pkrosk8on9b91gf'�[0m
2020/02/25 19:14:30 packer-builder-azure-arm plugin: Azure request method="DELETE" request="https://management.azure.com/subscriptions/<subscription>/resourceGroups/cotest-r1p2-packer/providers/Microsoft.Compute/disks/pkrosk8on9b91gf?api-version=2018-04-01" body=""
2020/02/25 19:14:30 packer-builder-azure-arm plugin: Azure response method="DELETE" request="https://management.azure.com/subscriptions/<subscription>/resourceGroups/cotest-r1p2-packer/providers/Microsoft.Compute/disks/pkrosk8on9b91gf?api-version=2018-04-01" x-ms-request-id="478da515-cef9-47e2-997b-4ebd5c6995d8" body="" status="202 Accepted"
2020/02/25 19:14:30 packer-builder-azure-arm plugin: Azure request method="GET" request="https://management.azure.com/subscriptions/<subscription>/providers/Microsoft.Compute/locations/southcentralus/DiskOperations/478da515-cef9-47e2-997b-4ebd5c6995d8?api-version=2018-04-01" body=""
2020/02/25 19:14:30 packer-builder-azure-arm plugin: Azure response status="200 OK" method="GET" request="https://management.azure.com/subscriptions/<subscription>/providers/Microsoft.Compute/locations/southcentralus/DiskOperations/478da515-cef9-47e2-997b-4ebd5c6995d8?api-version=2018-04-01" x-ms-request-id="37747033-a8ea-42fd-9e3d-fabda93f9304" body="{\r\n  \"startTime\": \"2020-02-25T19:14:30.1064547+00:00\",\r\n  \"status\": \"InProgress\",\r\n  \"name\": \"478da515-cef9-47e2-997b-4ebd5c6995d8\"\r\n}"
2020/02/25 19:15:30 packer-builder-azure-arm plugin: Azure request method="GET" request="https://management.azure.com/subscriptions/<subscription>/providers/Microsoft.Compute/locations/southcentralus/DiskOperations/478da515-cef9-47e2-997b-4ebd5c6995d8?api-version=2018-04-01" body=""
2020/02/25 19:15:30 packer-builder-azure-arm plugin: Azure response body="{\r\n  \"startTime\": \"2020-02-25T19:14:30.1064547+00:00\",\r\n  \"endTime\": \"2020-02-25T19:14:30.4186632+00:00\",\r\n  \"status\": \"Succeeded\",\r\n  \"name\": \"478da515-cef9-47e2-997b-4ebd5c6995d8\"\r\n}" status="200 OK" method="GET" request="https://management.azure.com/subscriptions/<subscription>/providers/Microsoft.Compute/locations/southcentralus/DiskOperations/478da515-cef9-47e2-997b-4ebd5c6995d8?api-version=2018-04-01" x-ms-request-id="23a5648a-e873-457a-b846-d5c3858ea3c5"
2020/02/25 19:15:30 ui: �[1;32m==> azure-arm: Deleting the temporary Additional disk ...�[0m
2020/02/25 19:15:30 ui: �[1;32m==> azure-arm: Removing the created Deployment object: 'pkrdpk8on9b91gf'�[0m
2020/02/25 19:15:30 packer-builder-azure-arm plugin: Azure request request="https://management.azure.com/subscriptions/<subscription>/resourcegroups/cotest-r1p2-packer/providers/Microsoft.Resources/deployments/pkrdpk8on9b91gf?api-version=2018-02-01" body="" method="DELETE"
2020/02/25 19:15:30 packer-builder-azure-arm plugin: Azure response status="202 Accepted" method="DELETE" request="https://management.azure.com/subscriptions/<subscription>/resourcegroups/cotest-r1p2-packer/providers/Microsoft.Resources/deployments/pkrdpk8on9b91gf?api-version=2018-02-01" x-ms-request-id="0cb987cd-8626-4328-beae-b6beefdcd262" body=""
2020/02/25 19:15:30 packer-builder-azure-arm plugin: Azure request body="" method="GET" request="https://management.azure.com/subscriptions/<subscription>/operationresults/eyJqb2JJZCI6IkRlcGxveW1lbnREZWxldGlvbkpvYi1HTlMtQ09URVNUOjJEUjFQMjoyRFBBQ0tFUi1QS1JEUEs4T045QjkxR0YtIiwiam9iTG9jYXRpb24iOiJzb3V0aGNlbnRyYWx1cyJ9?api-version=2018-02-01"
2020/02/25 19:15:30 packer-builder-azure-arm plugin: Azure response body="" status="202 Accepted" method="GET" request="https://management.azure.com/subscriptions/<subscription>/operationresults/eyJqb2JJZCI6IkRlcGxveW1lbnREZWxldGlvbkpvYi1HTlMtQ09URVNUOjJEUjFQMjoyRFBBQ0tFUi1QS1JEUEs4T045QjkxR0YtIiwiam9iTG9jYXRpb24iOiJzb3V0aGNlbnRyYWx1cyJ9?api-version=2018-02-01" x-ms-request-id="00866a35-8421-4fe8-ab87-4e925bd34029"
2020/02/25 19:15:45 packer-builder-azure-arm plugin: Azure request method="GET" request="https://management.azure.com/subscriptions/<subscription>/operationresults/eyJqb2JJZCI6IkRlcGxveW1lbnREZWxldGlvbkpvYi1HTlMtQ09URVNUOjJEUjFQMjoyRFBBQ0tFUi1QS1JEUEs4T045QjkxR0YtIiwiam9iTG9jYXRpb24iOiJzb3V0aGNlbnRyYWx1cyJ9?api-version=2018-02-01" body=""
2020/02/25 19:15:45 packer-builder-azure-arm plugin: Azure response status="202 Accepted" method="GET" request="https://management.azure.com/subscriptions/<subscription>/operationresults/eyJqb2JJZCI6IkRlcGxveW1lbnREZWxldGlvbkpvYi1HTlMtQ09URVNUOjJEUjFQMjoyRFBBQ0tFUi1QS1JEUEs4T045QjkxR0YtIiwiam9iTG9jYXRpb24iOiJzb3V0aGNlbnRyYWx1cyJ9?api-version=2018-02-01" x-ms-request-id="a031f1ad-0084-475e-958a-2a805104c08d" body=""
2020/02/25 19:16:00 packer-builder-azure-arm plugin: Azure request method="GET" request="https://management.azure.com/subscriptions/<subscription>/operationresults/eyJqb2JJZCI6IkRlcGxveW1lbnREZWxldGlvbkpvYi1HTlMtQ09URVNUOjJEUjFQMjoyRFBBQ0tFUi1QS1JEUEs4T045QjkxR0YtIiwiam9iTG9jYXRpb24iOiJzb3V0aGNlbnRyYWx1cyJ9?api-version=2018-02-01" body=""
2020/02/25 19:16:00 packer-builder-azure-arm plugin: Azure response body="" status="202 Accepted" method="GET" request="https://management.azure.com/subscriptions/<subscription>/operationresults/eyJqb2JJZCI6IkRlcGxveW1lbnREZWxldGlvbkpvYi1HTlMtQ09URVNUOjJEUjFQMjoyRFBBQ0tFUi1QS1JEUEs4T045QjkxR0YtIiwiam9iTG9jYXRpb24iOiJzb3V0aGNlbnRyYWx1cyJ9?api-version=2018-02-01" x-ms-request-id="542f70c7-784f-4b91-b269-86a72c8b105e"
2020/02/25 19:16:15 packer-builder-azure-arm plugin: Azure request request="https://management.azure.com/subscriptions/<subscription>/operationresults/eyJqb2JJZCI6IkRlcGxveW1lbnREZWxldGlvbkpvYi1HTlMtQ09URVNUOjJEUjFQMjoyRFBBQ0tFUi1QS1JEUEs4T045QjkxR0YtIiwiam9iTG9jYXRpb24iOiJzb3V0aGNlbnRyYWx1cyJ9?api-version=2018-02-01" body="" method="GET"
2020/02/25 19:16:15 ui: �[1;32m==> azure-arm: Removing the created Deployment object: 'kvpkrdpk8on9b91gf'�[0m
2020/02/25 19:16:15 packer-builder-azure-arm plugin: Azure response body="" status="204 No Content" method="GET" request="https://management.azure.com/subscriptions/<subscription>/operationresults/eyJqb2JJZCI6IkRlcGxveW1lbnREZWxldGlvbkpvYi1HTlMtQ09URVNUOjJEUjFQMjoyRFBBQ0tFUi1QS1JEUEs4T045QjkxR0YtIiwiam9iTG9jYXRpb24iOiJzb3V0aGNlbnRyYWx1cyJ9?api-version=2018-02-01" x-ms-request-id="574714ec-523d-47e5-9dfe-b9c48e8c555b"
2020/02/25 19:16:15 packer-builder-azure-arm plugin: Azure request method="DELETE" request="https://management.azure.com/subscriptions/<subscription>/resourcegroups/cotest-r1p2-packer/providers/Microsoft.Resources/deployments/kvpkrdpk8on9b91gf?api-version=2018-02-01" body=""
2020/02/25 19:16:15 packer-builder-azure-arm plugin: Azure response x-ms-request-id="ea69c50e-e915-475b-9543-352047d19298" body="" status="202 Accepted" method="DELETE" request="https://management.azure.com/subscriptions/<subscription>/resourcegroups/cotest-r1p2-packer/providers/Microsoft.Resources/deployments/kvpkrdpk8on9b91gf?api-version=2018-02-01"
2020/02/25 19:16:15 packer-builder-azure-arm plugin: Azure request method="GET" request="https://management.azure.com/subscriptions/<subscription>/operationresults/eyJqb2JJZCI6IkRlcGxveW1lbnREZWxldGlvbkpvYi1HTlMtQ09URVNUOjJEUjFQMjoyRFBBQ0tFUi1LVlBLUkRQSzhPTjlCOTFHRi0iLCJqb2JMb2NhdGlvbiI6InNvdXRoY2VudHJhbHVzIn0?api-version=2018-02-01" body=""
2020/02/25 19:16:15 packer-builder-azure-arm plugin: Azure response status="202 Accepted" method="GET" request="https://management.azure.com/subscriptions/<subscription>/operationresults/eyJqb2JJZCI6IkRlcGxveW1lbnREZWxldGlvbkpvYi1HTlMtQ09URVNUOjJEUjFQMjoyRFBBQ0tFUi1LVlBLUkRQSzhPTjlCOTFHRi0iLCJqb2JMb2NhdGlvbiI6InNvdXRoY2VudHJhbHVzIn0?api-version=2018-02-01" x-ms-request-id="daedda4c-2cdc-45ea-b9b4-6c9860b88e9f" body=""
2020/02/25 19:16:30 packer-builder-azure-arm plugin: Azure request method="GET" request="https://management.azure.com/subscriptions/<subscription>/operationresults/eyJqb2JJZCI6IkRlcGxveW1lbnREZWxldGlvbkpvYi1HTlMtQ09URVNUOjJEUjFQMjoyRFBBQ0tFUi1LVlBLUkRQSzhPTjlCOTFHRi0iLCJqb2JMb2NhdGlvbiI6InNvdXRoY2VudHJhbHVzIn0?api-version=2018-02-01" body=""
2020/02/25 19:16:30 packer-builder-azure-arm plugin: Azure response status="202 Accepted" method="GET" request="https://management.azure.com/subscriptions/<subscription>/operationresults/eyJqb2JJZCI6IkRlcGxveW1lbnREZWxldGlvbkpvYi1HTlMtQ09URVNUOjJEUjFQMjoyRFBBQ0tFUi1LVlBLUkRQSzhPTjlCOTFHRi0iLCJqb2JMb2NhdGlvbiI6InNvdXRoY2VudHJhbHVzIn0?api-version=2018-02-01" x-ms-request-id="7c9b7288-7d29-40c7-9986-867c8a85e938" body=""
2020/02/25 19:16:45 packer-builder-azure-arm plugin: Azure request method="GET" request="https://management.azure.com/subscriptions/<subscription>/operationresults/eyJqb2JJZCI6IkRlcGxveW1lbnREZWxldGlvbkpvYi1HTlMtQ09URVNUOjJEUjFQMjoyRFBBQ0tFUi1LVlBLUkRQSzhPTjlCOTFHRi0iLCJqb2JMb2NhdGlvbiI6InNvdXRoY2VudHJhbHVzIn0?api-version=2018-02-01" body=""
2020/02/25 19:16:45 packer-builder-azure-arm plugin: Azure response body="" status="202 Accepted" method="GET" request="https://management.azure.com/subscriptions/<subscription>/operationresults/eyJqb2JJZCI6IkRlcGxveW1lbnREZWxldGlvbkpvYi1HTlMtQ09URVNUOjJEUjFQMjoyRFBBQ0tFUi1LVlBLUkRQSzhPTjlCOTFHRi0iLCJqb2JMb2NhdGlvbiI6InNvdXRoY2VudHJhbHVzIn0?api-version=2018-02-01" x-ms-request-id="7f13f912-627e-4ff1-959c-2d08ce061b22"
2020/02/25 19:17:00 packer-builder-azure-arm plugin: Azure request method="GET" request="https://management.azure.com/subscriptions/<subscription>/operationresults/eyJqb2JJZCI6IkRlcGxveW1lbnREZWxldGlvbkpvYi1HTlMtQ09URVNUOjJEUjFQMjoyRFBBQ0tFUi1LVlBLUkRQSzhPTjlCOTFHRi0iLCJqb2JMb2NhdGlvbiI6InNvdXRoY2VudHJhbHVzIn0?api-version=2018-02-01" body=""
2020/02/25 19:17:00 packer-builder-azure-arm plugin: Azure response x-ms-request-id="336f933c-dcc7-42c5-987c-9fef74767dd7" body="" status="204 No Content" method="GET" request="https://management.azure.com/subscriptions/<subscription>/operationresults/eyJqb2JJZCI6IkRlcGxveW1lbnREZWxldGlvbkpvYi1HTlMtQ09URVNUOjJEUjFQMjoyRFBBQ0tFUi1LVlBLUkRQSzhPTjlCOTFHRi0iLCJqb2JMb2NhdGlvbiI6InNvdXRoY2VudHJhbHVzIn0?api-version=2018-02-01"
2020/02/25 19:17:00 [INFO] (telemetry) ending azure-arm
2020/02/25 19:17:00 ui: �[1;32mBuild 'azure-arm' finished.�[0m

@ghost ghost removed stage/waiting-reply labels Feb 25, 2020
@nfischer2
Copy link

When using new option added in 1.5.2 to specify a keyvault "build_key_vault_name" Image build completes but the Packer build fails with ##[error]Error: The process '/usr/bin/packer' failed with exit code 1

Looks like Packer is trying to delete a temporary KeyVault that was not created due to the new config option "build_key_vault_name" being used. Build 'azure-arm' errored: resources.DeploymentOperationsClient#List: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="DeploymentNotFound" Message="Deployment 'kvpkrdpce95x3b6eb' could not be found."

2020-02-27T14:52:22.9430244Z ==============================================================================
2020-02-27T14:52:22.9430545Z Task         : Build machine image
2020-02-27T14:52:22.9430904Z Description  : Build a machine image using Packer, which may be used for Azure Virtual machine scale set deployment
2020-02-27T14:52:22.9431232Z Version      : 1.1.12
2020-02-27T14:52:22.9431445Z Author       : Microsoft Corporation
2020-02-27T14:52:22.9431767Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/deploy/packer-build
2020-02-27T14:52:22.9432454Z ==============================================================================
2020-02-27T14:52:23.2602589Z Parsing custom template parameters json.
2020-02-27T14:52:23.2604504Z Parsing additional builder parameters json.
2020-02-27T14:52:23.2630748Z [command]/usr/bin/packer --version
2020-02-27T14:52:23.4980344Z 1.5.2
2020-02-27T14:52:23.4981281Z Current installed packer version is 1.5.2.
2020-02-27T14:52:23.5009686Z Running packer fix command
2020-02-27T14:52:23.5012069Z [command]/usr/bin/packer fix -validate=false /home/siu0699/vstsagent/agent2/_work/r19/a/_VMSS-Win2019-IIS-Packer/drop/Windows/Server2019/packer/app.json
2020-02-27T14:52:23.7881240Z {
2020-02-27T14:52:23.7881526Z   "builders": [
2020-02-27T14:52:23.7881675Z     {
2020-02-27T14:52:23.7881838Z       "azure_tags": {
2020-02-27T14:52:23.7882140Z         "department": "*",
2020-02-27T14:52:23.7882354Z         "owner": "*",
2020-02-27T14:52:23.7882541Z         "test": "*"
2020-02-27T14:52:23.7882729Z       },
2020-02-27T14:52:23.7883466Z       "build_key_vault_name": "ExistingKeyVault",
2020-02-27T14:52:23.7883898Z       "build_resource_group_name": "RG",
2020-02-27T14:52:23.7884183Z       "client_id": "{{user `client_id`}}",
2020-02-27T14:52:23.7884438Z       "client_secret": "{{user `client_secret`}}",
2020-02-27T14:52:23.7884685Z       "communicator": "winrm",
2020-02-27T14:52:23.7884906Z       "image_offer": "WindowsServer",
2020-02-27T14:52:23.7885175Z       "image_publisher": "MicrosoftWindowsServer",
2020-02-27T14:52:23.7885921Z       "image_sku": "2019-Datacenter",
2020-02-27T14:52:23.7886458Z       "managed_image_name": "{{isotime \"200601020304\"}}",
2020-02-27T14:52:23.7887032Z       "managed_image_resource_group_name": "RG",
2020-02-27T14:52:23.7887391Z       "os_type": "Windows",
2020-02-27T14:52:23.7887687Z       "subscription_id": "{{user `subscription_id`}}",
2020-02-27T14:52:23.7888030Z       "tenant_id": "{{user `tenant_id`}}",
2020-02-27T14:52:23.7889413Z       "type": "azure-arm",
2020-02-27T14:52:23.7889880Z       "virtual_network_name": "RG-net",
2020-02-27T14:52:23.7890357Z       "virtual_network_resource_group_name": "RG-net",
2020-02-27T14:52:23.7890822Z       "virtual_network_subnet_name": "RG-subnet",
2020-02-27T14:52:23.7891217Z       "vm_size": "Standard_DS3_v2",
2020-02-27T14:52:23.7891453Z       "winrm_insecure": "true",
2020-02-27T14:52:23.7891774Z       "winrm_timeout": "15m",
2020-02-27T14:52:23.7892075Z       "winrm_use_ssl": "true",
2020-02-27T14:52:23.7892386Z       "winrm_username": "packer"
2020-02-27T14:52:23.7892588Z     }
2020-02-27T14:52:23.7892726Z   ],
2020-02-27T14:52:23.7892885Z   "provisioners": [
2020-02-27T14:52:23.7893150Z     {
2020-02-27T14:52:23.7893313Z       "inline": [
2020-02-27T14:52:23.7893627Z         " # NOTE: the following *3* lines are only needed if the you have installed the Guest Agent.",
2020-02-27T14:52:23.7894252Z         "  while ((Get-Service RdAgent).Status -ne 'Running') { Start-Sleep -s 5 }",
2020-02-27T14:52:23.7894904Z         "  while ((Get-Service WindowsAzureTelemetryService).Status -ne 'Running') { Start-Sleep -s 5 }",
2020-02-27T14:52:23.7895562Z         "  while ((Get-Service WindowsAzureGuestAgent).Status -ne 'Running') { Start-Sleep -s 5 }",
2020-02-27T14:52:23.7896068Z         "\u0026 $env:SystemRoot\\System32\\Sysprep\\Sysprep.exe /oobe /generalize /quiet /quit /mode:vm",
2020-02-27T14:52:23.7897431Z         "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 } }"
2020-02-27T14:52:23.7898085Z       ],
2020-02-27T14:52:23.7898277Z       "type": "powershell"
2020-02-27T14:52:23.7898453Z     }
2020-02-27T14:52:23.7898608Z   ],
2020-02-27T14:52:23.7898764Z   "variables": {
2020-02-27T14:52:23.7898962Z     "client_id": "",
2020-02-27T14:52:23.7899317Z     "client_secret": "",
2020-02-27T14:52:23.7899523Z     "subscription": "",
2020-02-27T14:52:23.7899745Z     "subscription_id": "",
2020-02-27T14:52:23.7899947Z     "tenant_id": ""
2020-02-27T14:52:23.7900108Z   }
2020-02-27T14:52:23.7900328Z }
2020-02-27T14:52:23.7900435Z 
2020-02-27T14:52:23.7947980Z Running packer validate command to ensure template is valid
2020-02-27T14:52:23.7949690Z [command]/usr/bin/packer validate -var-file=/home/siu0699/vstsagent/agent2/_work/_temp/x8hthramj1n81ppep3fskyb9.json -var-file=/home/siu0699/vstsagent/agent2/_work/_temp/r2u23hjd8itjv27nvg1vjwcdi.json /home/siu0699/vstsagent/agent2/_work/r19/a/_VMSS-Win2019-IIS-Packer/drop/Windows/Server2019/packer/app-fixed.json
2020-02-27T14:52:24.4752477Z Template validated successfully.
2020-02-27T14:52:24.4770329Z Running packer build command. Waiting for it to finish...
2020-02-27T14:52:24.4788520Z [command]/usr/bin/packer build -force -color=false -var-file=/home/siu0699/vstsagent/agent2/_work/_temp/avsflk1tvays1csqoh7yi7ldi.json -var-file=/home/siu0699/vstsagent/agent2/_work/_temp/l3khoykrasot6u2681jhmpldi.json /home/siu0699/vstsagent/agent2/_work/r19/a/_VMSS-Win2019-IIS-Packer/drop/Windows/Server2019/packer/app-fixed.json
2020-02-27T14:52:24.4789159Z 
2020-02-27T14:52:24.8069414Z ==> azure-arm: Running builder ...
2020-02-27T14:52:24.8070880Z 
2020-02-27T14:52:24.8077187Z ==> azure-arm: Getting tokens using client secret
2020-02-27T14:52:24.8077538Z 
2020-02-27T14:52:25.3165654Z ==> azure-arm: Getting tokens using client secret
2020-02-27T14:52:25.3165922Z 
2020-02-27T14:52:25.5735276Z     azure-arm: Creating Azure Resource Manager (ARM) client ...
2020-02-27T14:52:25.5735671Z 
2020-02-27T14:52:25.9070105Z ==> azure-arm: Using existing resource group ...
2020-02-27T14:52:25.9071207Z 
2020-02-27T14:52:25.9077150Z ==> azure-arm:  -> ResourceGroupName : 'RG'
2020-02-27T14:52:25.9077822Z ==> azure-arm:  -> Location          : 'eastus2'
2020-02-27T14:52:25.9078027Z 
2020-02-27T14:52:25.9079768Z ==> azure-arm: Setting the certificate in the KeyVault...
2020-02-27T14:52:25.9079949Z 
2020-02-27T14:52:26.2352638Z ==> azure-arm: Getting the certificate's URL ...
2020-02-27T14:52:26.2353332Z 
2020-02-27T14:52:26.2356117Z ==> azure-arm:  -> Key Vault Name        : 'ExisitngKeyVault'
2020-02-27T14:52:26.2356332Z 
2020-02-27T14:52:26.2357993Z ==> azure-arm:  -> Key Vault Secret Name : 'packerKeyVaultSecret'
2020-02-27T14:52:26.2358217Z 
2020-02-27T14:52:26.4086603Z ==> azure-arm:  -> Certificate URL       : 'https://ExistingKeyVault'
2020-02-27T14:52:26.4087460Z 
2020-02-27T14:52:26.4100879Z ==> azure-arm: Setting the certificate's URL ...
2020-02-27T14:52:26.4101268Z 
2020-02-27T14:52:26.4113808Z ==> azure-arm: Validating deployment template ...
2020-02-27T14:52:26.4114393Z 
2020-02-27T14:52:26.4120071Z ==> azure-arm:  -> ResourceGroupName : 'RG'
2020-02-27T14:52:26.4120603Z 
2020-02-27T14:52:26.4124379Z ==> azure-arm:  -> DeploymentName    : 'pkrdpce95x3b6eb'
2020-02-27T14:52:26.4124615Z 
2020-02-27T14:52:27.3643784Z ==> azure-arm: Deploying deployment template ...
2020-02-27T14:52:27.3644862Z ==> azure-arm:  -> ResourceGroupName : 'RG'
2020-02-27T14:52:27.3645513Z 
2020-02-27T14:52:27.3650028Z ==> azure-arm:  -> DeploymentName    : 'pkrdpce95x3b6eb'
2020-02-27T14:52:27.3650259Z 
2020-02-27T14:57:28.5942135Z ==> azure-arm: Getting the VM's IP address ...
2020-02-27T14:57:28.5942910Z 
2020-02-27T14:57:28.5949345Z ==> azure-arm:  -> ResourceGroupName   : 'RG'
2020-02-27T14:57:28.5949577Z 
2020-02-27T14:57:28.5951234Z ==> azure-arm:  -> PublicIPAddressName : 'pkripce95x3b6eb'
2020-02-27T14:57:28.5951426Z 
2020-02-27T14:57:28.5953297Z ==> azure-arm:  -> NicName             : 'pkrnice95x3b6eb'
2020-02-27T14:57:28.5953491Z 
2020-02-27T14:57:28.5962853Z ==> azure-arm:  -> Network Connection  : 'PrivateEndpoint'
2020-02-27T14:57:28.5963109Z 
2020-02-27T14:57:28.6952884Z ==> azure-arm:  -> IP Address          : '10.10.10.10'
2020-02-27T14:57:28.6953493Z 
2020-02-27T14:57:28.6955480Z ==> azure-arm: Waiting for WinRM to become available...
2020-02-27T14:57:28.6955663Z 
2020-02-27T14:57:51.0540808Z ==> azure-arm: #< CLIXML
2020-02-27T14:57:51.0541149Z 
2020-02-27T14:57:52.5938428Z     azure-arm: WinRM connected.
2020-02-27T14:57:52.5938722Z 
2020-02-27T14:57:52.5944456Z ==> azure-arm: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj><Obj S="progress" RefId="1"><TNRef RefId="0" /><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj></Objs>
2020-02-27T14:57:52.5945544Z 
2020-02-27T14:57:52.6018399Z ==> azure-arm: Connected to WinRM!
2020-02-27T14:57:52.6018655Z 
2020-02-27T14:57:52.6020497Z ==> azure-arm: Provisioning with Powershell...
2020-02-27T14:57:52.6020669Z 
2020-02-27T14:57:52.6022561Z ==> azure-arm: Provisioning with powershell script: /tmp/powershell-provisioner421290176
2020-02-27T14:57:52.6022803Z 
2020-02-27T14:57:58.3352518Z     azure-arm: IMAGE_STATE_COMPLETE
2020-02-27T14:57:58.3353158Z 
2020-02-27T14:58:08.3575584Z     azure-arm: IMAGE_STATE_UNDEPLOYABLE
2020-02-27T14:58:08.3576299Z 
2020-02-27T14:58:17.8789080Z ==> azure-arm: Querying the machine's properties ...
2020-02-27T14:58:17.8790747Z 
2020-02-27T14:58:17.8795841Z ==> azure-arm:  -> ResourceGroupName : 'RG'
2020-02-27T14:58:17.8796752Z 
2020-02-27T14:58:17.8801064Z ==> azure-arm:  -> ComputeName       : 'pkrvmce95x3b6eb'
2020-02-27T14:58:17.8801449Z 
2020-02-27T14:58:17.9757440Z ==> azure-arm:  -> Managed OS Disk   : '/subscriptions/***/resourceGroups*/providers/Microsoft.Compute/disks/pkrosce95x3b6eb'
2020-02-27T14:58:17.9759319Z 
2020-02-27T14:58:17.9764301Z ==> azure-arm: Querying the machine's additional disks properties ...
2020-02-27T14:58:17.9764712Z 
2020-02-27T14:58:17.9768544Z ==> azure-arm:  -> ResourceGroupName : 'RG'
2020-02-27T14:58:17.9768927Z 
2020-02-27T14:58:17.9773086Z ==> azure-arm:  -> ComputeName       : 'pkrvmce95x3b6eb'
2020-02-27T14:58:17.9773663Z 
2020-02-27T14:58:18.0545156Z ==> azure-arm: Powering off machine ...
2020-02-27T14:58:18.0546067Z 
2020-02-27T14:58:18.0551109Z ==> azure-arm:  -> ResourceGroupName : 'RG'
2020-02-27T14:58:18.0551486Z 
2020-02-27T14:58:18.0554547Z ==> azure-arm:  -> ComputeName       : 'pkrvmce95x3b6eb'
2020-02-27T14:58:18.0554777Z 
2020-02-27T14:59:54.4701533Z ==> azure-arm: Capturing image ...
2020-02-27T14:59:54.4702567Z 
2020-02-27T14:59:54.4706640Z ==> azure-arm:  -> Compute ResourceGroupName : 'RG'
2020-02-27T14:59:54.4707265Z ==> azure-arm:  -> Compute Name              : 'pkrvmce95x3b6eb'
2020-02-27T14:59:54.4707940Z ==> azure-arm:  -> Compute Location          : 'eastus2'
2020-02-27T14:59:54.4708255Z 
2020-02-27T14:59:54.5573912Z ==> azure-arm:  -> Image ResourceGroupName   : 'RG'
2020-02-27T14:59:54.5574657Z 
2020-02-27T14:59:54.5576887Z ==> azure-arm:  -> Image Name                : '202002270252'
2020-02-27T14:59:54.5577190Z 
2020-02-27T14:59:54.5579493Z ==> azure-arm:  -> Image Location            : 'eastus2'
2020-02-27T14:59:54.5579792Z 
2020-02-27T15:00:55.4698190Z ==> azure-arm: Deleting resource group ...
2020-02-27T15:00:55.4699960Z 
2020-02-27T15:00:55.4704677Z ==> azure-arm:  -> ResourceGroupName : 'RG'
2020-02-27T15:00:55.4705194Z 
2020-02-27T15:00:55.4708494Z ==> azure-arm: 
2020-02-27T15:00:55.4708764Z 
2020-02-27T15:00:55.4711821Z ==> azure-arm: The resource group was not created by Packer, only deleting individual resources ...
2020-02-27T15:00:55.4712259Z 
2020-02-27T15:00:55.5404227Z ==> azure-arm:  -> Microsoft.Compute/virtualMachines : 'pkrvmce95x3b6eb'
2020-02-27T15:00:55.5404908Z 
2020-02-27T15:02:26.0247183Z ==> azure-arm:  -> Microsoft.Network/networkInterfaces : 'pkrnice95x3b6eb'
2020-02-27T15:02:26.0248038Z 
2020-02-27T15:02:26.6397612Z ==> azure-arm: Error deleting resource. Please delete manually.
2020-02-27T15:02:26.6398427Z 
2020-02-27T15:02:26.6406807Z ==> azure-arm: 
2020-02-27T15:02:26.6411331Z ==> azure-arm: Name: RG
2020-02-27T15:02:26.6411593Z 
2020-02-27T15:02:26.6413846Z ==> azure-arm: Error: resources.DeploymentOperationsClient#List: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="DeploymentNotFound" Message="Deployment 'kvpkrdpce95x3b6eb' could not be found."
2020-02-27T15:02:26.6414364Z 
2020-02-27T15:02:26.6416413Z ==> azure-arm: resources.DeploymentOperationsClient#List: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="DeploymentNotFound" Message="Deployment 'kvpkrdpce95x3b6eb' could not be found."
2020-02-27T15:02:26.6416916Z 
2020-02-27T15:02:26.6418967Z ==> azure-arm: resources.DeploymentOperationsClient#List: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="DeploymentNotFound" Message="Deployment 'kvpkrdpce95x3b6eb' could not be found."
2020-02-27T15:02:26.6419447Z 
2020-02-27T15:02:26.6421160Z ==> azure-arm: Provisioning step had errors: Running the cleanup provisioner, if present...
2020-02-27T15:02:26.6421547Z ==> azure-arm: 
2020-02-27T15:02:26.6421964Z ==> azure-arm: The resource group was not created by Packer, deleting individual resources ...
2020-02-27T15:02:26.6422382Z 
2020-02-27T15:02:26.6951593Z ==> azure-arm: Could not retrieve OS Image details
2020-02-27T15:02:26.6951902Z 
2020-02-27T15:02:26.6953888Z ==> azure-arm:  -> Deployment Resources within: pkrdpce95x3b6eb
2020-02-27T15:02:26.6954093Z 
2020-02-27T15:02:26.7795595Z ==> azure-arm:  -> Microsoft.Compute/virtualMachines : 'pkrvmce95x3b6eb'
2020-02-27T15:02:26.7796317Z 
2020-02-27T15:02:26.8426437Z ==> azure-arm:  -> Microsoft.Network/networkInterfaces : 'pkrnice95x3b6eb'
2020-02-27T15:02:26.8427449Z 
2020-02-27T15:02:27.5684101Z ==> azure-arm:  ->  : ''
2020-02-27T15:02:27.5684956Z 
2020-02-27T15:02:27.5688910Z ==> azure-arm: Error deleting resource.  Please delete manually.
2020-02-27T15:02:27.5689573Z ==> azure-arm: 
2020-02-27T15:02:27.5690670Z ==> azure-arm: Name: 
2020-02-27T15:02:27.5691158Z ==> azure-arm: Error: Unable to parse path of image
2020-02-27T15:02:27.5691620Z ==> azure-arm: Removing the created Deployment object: 'pkrdpce95x3b6eb'
2020-02-27T15:02:27.5691894Z 
2020-02-27T15:03:13.5305587Z ==> azure-arm: 
2020-02-27T15:03:13.5306498Z ==> azure-arm: The resource group was not created by Packer, not deleting ...
2020-02-27T15:03:13.5307150Z 
2020-02-27T15:03:13.5313867Z Build 'azure-arm' errored: resources.DeploymentOperationsClient#List: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="DeploymentNotFound" Message="Deployment 'kvpkrdpce95x3b6eb' could not be found."
2020-02-27T15:03:13.5314540Z 
2020-02-27T15:03:13.5314985Z ==> Some builds didn't complete successfully and had errors:
2020-02-27T15:03:13.5315286Z 
2020-02-27T15:03:13.5318881Z --> azure-arm: resources.DeploymentOperationsClient#List: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="DeploymentNotFound" Message="Deployment 'kvpkrdpce95x3b6eb' could not be found."
2020-02-27T15:03:13.5319851Z 
2020-02-27T15:03:13.5320152Z ==> Builds finished but no artifacts were created.
2020-02-27T15:03:13.5320439Z 
2020-02-27T15:03:13.8390242Z ##[error]Error: The process '/usr/bin/packer' failed with exit code 1
2020-02-27T15:03:13.8411263Z ##[section]Finishing: Build immutable image

@SwampDragons SwampDragons added this to the 1.5.5 milestone Feb 28, 2020
@amarkulis
Copy link

amarkulis commented Mar 16, 2020

I am seeing this behavior too. I see the issue as the KV packer is trying to clean up is not the same name as the one it provisions. eg..

==> azure-arm: -> Key Vault Name : 'pkrkv65gv9k9b8g'

==> azure-arm: -> Key Vault Secret Name : 'packerKeyVaultSecret'

==> azure-arm: -> Certificate URL : 'https://pkrkv65gv9k9b8g.vault.azure.net/secrets/packerKeyVaultSecret/f52a90173e3a4af18bf55d7a2520e776'

But what packer tries to delete....

==>_ azure-arm: Removing the created Deployment object: 'kvpkrdp65gv9k9b8g'

@SwampDragons
Copy link
Contributor

One is the vault itself, the other is the deployment. Those are two different things, I believe. I'm investigating this issue now.

@SwampDragons
Copy link
Contributor

I believe I've fixed at least two variants of this error in the linked PR: test builds can be found here: https://circleci.com/gh/hashicorp/packer/40035#artifacts/containers/0

@nfischer2
Copy link

1.5.5 fixed this issue for me. Thanks!

@ghost
Copy link

ghost commented Apr 18, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants