From e189db97d40d6d441d3f04ed237189b8f66ee861 Mon Sep 17 00:00:00 2001 From: Paul Meyer Date: Wed, 16 Jan 2019 00:31:23 +0000 Subject: [PATCH] [azure] deallocate instead of just power-off 1. allegedly prevents error where fails because VM still appears running 2. prevents left-behind VM's after failures from accumulating charges --- builder/azure/arm/step_power_off_compute.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/azure/arm/step_power_off_compute.go b/builder/azure/arm/step_power_off_compute.go index da0ede214..4f03adefd 100644 --- a/builder/azure/arm/step_power_off_compute.go +++ b/builder/azure/arm/step_power_off_compute.go @@ -28,7 +28,7 @@ func NewStepPowerOffCompute(client *AzureClient, ui packer.Ui) *StepPowerOffComp } func (s *StepPowerOffCompute) powerOffCompute(ctx context.Context, resourceGroupName string, computeName string) error { - f, err := s.client.VirtualMachinesClient.PowerOff(ctx, resourceGroupName, computeName) + f, err := s.client.VirtualMachinesClient.Deallocate(ctx, resourceGroupName, computeName) if err == nil { err = f.WaitForCompletion(ctx, s.client.VirtualMachinesClient.Client) }