From 4c590d0595af48bf774a48fa3810a4d8469db2d6 Mon Sep 17 00:00:00 2001 From: Dennis Ameling Date: Tue, 20 Dec 2022 13:35:49 +0100 Subject: [PATCH] Add logic to deallocate VM --- .github/workflows/create-azure-vm-runners.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/create-azure-vm-runners.yml b/.github/workflows/create-azure-vm-runners.yml index c391f20..561f631 100644 --- a/.github/workflows/create-azure-vm-runners.yml +++ b/.github/workflows/create-azure-vm-runners.yml @@ -106,3 +106,10 @@ jobs: resourceGroupName: ${{ secrets.AZURE_RESOURCE_GROUP }} template: ./azure-arm-template.json parameters: ./azure-arm-template-example-parameters.json githubActionsRunnerRegistrationUrl="${{ env.ACTIONS_RUNNER_REGISTRATION_URL }}" githubActionsRunnerToken="${{ env.ACTIONS_RUNNER_TOKEN }}" postDeploymentPsScriptUrl="${{ env.POST_DEPLOYMENT_SCRIPT_URL }}" virtualMachineName=${{ steps.generate-vm-name.outputs.vm_name }} virtualMachineSize=Standard_D8pls_v5 publicIpAddressName1=${{ steps.generate-vm-name.outputs.vm_name }}-ip adminUsername=${{ secrets.AZURE_VM_USERNAME }} adminPassword=${{ secrets.AZURE_VM_PASSWORD }} + + - name: Deallocate the VM for later use + uses: azure/CLI@v1 + with: + azcliversion: 2.43.0 + inlineScript: | + az vm deallocate -n ${{ steps.generate-vm-name.outputs.vm_name }} -g ${{ secrets.AZURE_RESOURCE_GROUP }} --verbose