Delete untagged Azure Virtual Machines
This workflow looks at all of the Azure Virtual Machines in a given subscription and (optionally) resource group that are untagged and terminates the ones that have no tags. Requires an Azure account with permissions to delete Virtual Machines.
Before you run this workflow, you will need the following:
- An Azure Subscription
- An Azure Service Principal with permissions to manage compute resources
- One or more running Azure Virtual Machines with no tags.
Run the workflow
Follow these steps to run the workflow:
1. Add your Azure credentials as a Connection:
- Click Setup
- Find the Connection named
my-azure-accountand click Edit(✎). Use the following values:
- VALUE: Enter your Azure Client ID associated with the service principal
- VALUE: Enter your Azure Secret associated with the service principal
- VALUE: Enter your Azure Tenant ID associated with the service principal
- VALUE: Enter your Azure Subscription ID
- Click Save
- Click Run workflow and wait for the workflow run page to appear.
Supply following parameters to the modal:
- VALUE: True if you don't want to perform actual WRITE operations
Warning: If you run the workflow with the
dryRunparameter set to
false, virtual machines that are untagged will immediately be terminated.
Run the workflow on a schedule
Follow these steps to run this workflow on a schedule:
- Un-comment out the Trigger block in the workflow file:
TIP: If you're using the Relay code editor, highlight the
triggerssection and type
⌘ + /(Mac) or
Ctrl + /(Windows) to uncomment.
# triggers: # - name: schedule # source: # type: schedule # schedule: '0 * * * *' # binding: # parameters: # dryRun: true
- Configure the
- Supply the run interval in cron format.
- Configure the following parameter bindings:
- Specify whether
dryRunshould be set to
- Specify whether
- Click Save changes