Edit

Copy and paste to and from a VM via Bastion

Azure Bastion supports copying and pasting text between your local device and a remote VM session directly through the browser. This lets you transfer commands, configuration values, and other text without having to retype them manually. If your browser supports the Clipboard API (such as Microsoft Edge or Google Chrome), you can use standard keyboard shortcuts. For browsers that don't support the Clipboard API, Bastion provides a clipboard tool palette.

Important

Only text copy/paste is supported. You can't copy and paste files or passwords. To transfer files, use a native client connection.

These steps apply to both Windows and Linux VMs connected through the browser. If you connect using a native client, see Configure Bastion for native client connections.

Prerequisites

Before you begin, verify that you meet the following criteria:

  • An Azure Bastion host deployed in the virtual network where the virtual machine is located, or in a peered virtual network. To set up a Bastion host, see Create a bastion host.

  • A virtual machine in the virtual network.

  • Required roles:

    • Reader role on the virtual machine.
    • Reader role on the NIC with the IP of the virtual machine.
    • Reader role on the Azure Bastion resource.
    • Reader role on the virtual network of the target virtual machine (if the Bastion deployment is in a peered virtual network).
  • Copy and paste is enabled by default for all Bastion sessions. To disable or re-enable this setting, you need the Standard SKU or higher. See Configure copy and paste.

See the Azure Bastion FAQ for additional requirements.

Configure copy and paste

Copy and paste is enabled by default for all Bastion sessions — you don't need to configure anything. If your organization's security policies require restricting clipboard access, you can disable copy and paste for web-based clients. Changing this setting requires the Standard SKU or higher. If you're using the Basic SKU, you must upgrade your SKU before you can toggle this feature.

To change the setting:

  1. In the Azure portal, go to your Bastion resource.
  2. Select Configuration on the left side.
    • To disable, clear the Copy and paste checkbox.
    • To enable, select the Copy and paste checkbox.
  3. Select Apply. The bastion host updates with the new configuration.

Copy and paste

If your browser supports the Clipboard API (such as Microsoft Edge or Google Chrome), you can copy and paste text between your local device and the remote session using standard keyboard shortcuts. This is the simplest method and works the same way as copying between applications on your local device.

  1. Connect to your virtual machine.
  2. When the Bastion session initializes, your browser prompts you for clipboard access. Select Allow to grant the Bastion web page access to your clipboard. Without this permission, copy and paste won't work in the session.
  3. Use keyboard shortcuts to copy and paste as usual. On macOS, the keyboard shortcut to paste is Shift+Ctrl+V.
  4. To copy text from the VM to your local device, select the text in the remote session, copy it (Ctrl+C), and paste it into any application on your local device.

Next steps