---
title: Stop an Azure virtual machine
source: https://docs.newrelic.com/docs/workflow-automation/setup-and-configure/actions-catalog/azure/azure-vm-stop
---

The Azure Virtual Machine (VM) actions let you manage the lifecycle of your Azure VM directly from your workflows.

## Stop a virtual machine [#azure-vm-stop]

This action stops an Azure VM using the [Azure Compute VM - Power Off](https://learn.microsoft.com/en-us/rest/api/compute/virtual-machines/power-off?view=rest-compute-2025-11-01&tabs=HTTP) REST API.

### Inputs

| Input field         | Optionality | Type    | Description                                                                                                                                                                                       |
| ------------------- | ----------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `clientId`          | Required    | String  | An Azure Service Principal `clientID`. Must be passed as a secret. See how to [register an Azure app](https://learn.microsoft.com/en-us/azure/azure-monitor/logs/api/register-app-for-token).     |
| `clientSecret`      | Required    | String  | An Azure Service Principal `clientSecret`. Must be passed as a secret. See how to [register an Azure app](https://learn.microsoft.com/en-us/azure/azure-monitor/logs/api/register-app-for-token). |
| `tenantId`          | Required    | String  | The Azure tenant identifier. Can be passed as a secret.                                                                                                                                           |
| `subscriptionId`    | Required    | String  | The Azure subscription identifier (for example, `"12345678-1234-1234-1234-123456789abc"`).                                                                                                        |
| `resourceGroupName` | Required    | String  | The name of the resource group that contains the virtual machine. For example, `"my-demo-rg"`.                                                                                                    |
| `vmName`            | Required    | String  | The name of the virtual machine to stop. For example, `"my-demo-vm"`.                                                                                                                             |
| `skipShutdown`      | Optional    | Boolean | Whether to skip the shutdown and power off the virtual machine immediately. Accepts `true` or `false`.                                                                                            |
| `selectors`         | Optional    | List    | A list of selectors used to extract specific values from the response. For example, `[{\"name\": \"statusCode\", \"expression\": \".response.status_code\"}]`.                                    |

### Outputs

| Output field   | Type    | Description                                                                                                                                                                                                                |
| -------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `success`      | Boolean | `success: true | false`                                                                                                                                                                                                    |
| `errorMessage` | String  | Failure reason as message.                                                                                                                                                                                                 |
| `response`     | Object  | `<azure api body response>`. For more information see the [Azure Compute VM - Power Off - REST API](https://learn.microsoft.com/en-us/rest/api/compute/virtual-machines/power-off?view=rest-compute-2025-11-01&tabs=HTTP). |

### Example

```yaml
name: azure-stop-vm
description: 'This stops a virtual machine'
steps:
  - name: azure_vm_stop_3
    type: action
    action: azure.vm.stop
    version: 1
    inputs:
      clientId: ${{ :secrets:azure-client-id }}
      clientSecret: ${{ :secrets:azure-client-secret }}
      tenantId: ${{ :secrets:azure-client-tenant }}
      subscriptionId: "12345678-1234-1234-1234-123456789abc"
      resourceGroupName: "my-resource-group"
      virtualMachineName: ‘my-demo-vm'
    next: end
```
