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

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

## Restart a virtual machine [#azure-vm-restart]

This action restarts an Azure VM using the [Azure Compute VM - Restart](https://learn.microsoft.com/en-us/rest/api/compute/virtual-machines/restart?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 restart. For example, `"my-demo-vm"`.                                                                                                                          |
| `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 - Restart - REST API](https://learn.microsoft.com/en-us/rest/api/compute/virtual-machines/restart?view=rest-compute-2025-11-01&tabs=HTTP). |

### Example

```yaml
name: azure-restart-vm

steps:
  - name: azure_vm_restart_1
    type: action
    action: azure.vm.restart
    version: 1
    inputs:
      clientId: ${{ :secrets:my-client-id }}
      clientSecret: ${{ :secrets:my-client-secret }}
      tenantId: ${{ :secrets:my-tenant-id }}
      subscriptionId: "12345678-1234-1234-1234-123456789abc"
      resourceGroupName: "my-demo-rg"
      vmName: "my-demo-vm"
      selectors:
        - name: statusCode
          expression: ".response.status_code"
```
