# Unlinking a VM or Yandex BareMetal server from a backup policy


To unlink a VM or BareMetal server from a backup policy:

{% list tabs group=instructions %}

- Management console {#console}

  1. In the [management console](https://console.yandex.cloud), select a folder where you want to unlink a VM or BareMetal server from a backup policy.
  1. Navigate to **Cloud Backup**.
  1. Navigate to the ![policies](../../../_assets/console-icons/calendar.svg) **Backup policies** tab.
  1. Select the backup policy to unlink a VM or BareMetal server from.
  1. Depending on the resource you want to unlink from the backup policy, under **Attached resources**, select the **Virtual machines** or **BareMetal servers** tab.
  1. In the row with the VM or BareMetal server you want to unlink from the backup policy, click ![options](../../../_assets/console-icons/ellipsis.svg) and select **Detach VM from policy** or **Detach server from policy**, respectively.
  1. In the window that opens, confirm this action.

- CLI {#cli}

  If you do not have the Yandex Cloud CLI yet, [install and initialize it](../../../cli/quickstart.md#install).

  The folder used by default is the one specified when [creating](../../../cli/operations/profile/profile-create.md) the CLI profile. To change the default folder, use the `yc config set folder-id <folder_ID>` command. You can also specify a different folder for any command using `--folder-name` or `--folder-id`. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  1. View the description of the CLI command to remove a VM or BareMetal server from a backup policy: 

      ```bash
      yc backup policy revoke --help
      ```

  1. Get the ID of the backup policy to unlink the VM or BareMetal server from:

      ```bash
      yc backup policy list
      ```
      
      Result:
      
      ```text
      +----------------------+----------------------+---------+---------+---------------------+---------------------+
      |          ID          |      FOLDER ID       |  NAME   | ENABLED |     CREATED AT      |     UPDATED AT      |
      +----------------------+----------------------+---------+---------+---------------------+---------------------+
      | abc7n3wln123******** | ghi681qpe789******** | policy1 | true    | 2023-07-03 09:12:02 | 2023-07-03 09:12:43 |
      | deflqbiwc456******** | ghi681qpe789******** | policy2 | true    | 2023-07-07 14:58:23 | 2023-07-07 14:58:23 |
      +----------------------+----------------------+---------+---------+---------------------+---------------------+
      ```

  1. Get the ID of the VM to unlink:

      ```bash
      yc compute instance list
      ```
      
      Result:
      
      ```text
      +----------------------+---------+---------------+---------+--------------+-------------+
      |          ID          |  NAME   |    ZONE ID    | STATUS  | EXTERNAL IP  | INTERNAL IP |
      +----------------------+---------+---------------+---------+--------------+-------------+
      | jklp0o9i8012******** | my-vm-1 | ru-central1-b | RUNNING | 51.250.**.** | 192.168.*.* |
      | mnoa5s6d8345******** | my-vm-2 | ru-central1-b | RUNNING | 84.201.**.** | 192.168.*.* |
      +----------------------+---------+---------------+---------+--------------+-------------+
      ```

      To get the BareMetal server IDs, select **BareMetal** from the list of services of the relevant [folder](../../../resource-manager/concepts/resources-hierarchy.md#folder) in the [management console](https://console.yandex.cloud). The IDs are specified in the server list in the **ID** field.

  1. Unlink the VM or BareMetal server by specifying the backup policy ID:

      ```bash
      yc backup policy revoke <policy_ID> \
        --instance-ids <VM_or_BareMetal_server_IDs>
      ```

      Where `--instance-ids` are the IDs of the VMs or BareMetal servers you need to unlink from the backup policy. Multiple IDs should be comma-separated.

  For more information about this command, see the [CLI reference](../../../cli/cli-ref/backup/cli-ref/policy/revoke.md).

- API {#api}

  Use the [revoke](../../backup/api-ref/Policy/revoke.md) REST API method for the [Policy](../../backup/api-ref/Policy/index.md) resource or the [PolicyService/Revoke](../../backup/api-ref/grpc/Policy/revoke.md) gRPC API call.

{% endlist %}

#### See also {#see-also}

* [Linking a VM or Yandex BareMetal server to a backup policy](attach-and-detach-vm.md)