You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/bastion/bastion-connect-vm-ssh-linux.md
+90-45Lines changed: 90 additions & 45 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,10 @@
2
2
title: 'Connect to a Linux VM using SSH'
3
3
titleSuffix: Azure Bastion
4
4
description: Learn how to use Azure Bastion to connect to Linux VM using SSH.
5
-
services: bastion
6
5
author: cherylmc
7
6
ms.service: bastion
8
7
ms.topic: how-to
9
-
ms.date: 10/12/2021
8
+
ms.date: 08/18/2022
10
9
ms.author: cherylmc
11
10
ms.custom: ignite-fall-2021
12
11
---
@@ -15,12 +14,9 @@ ms.custom: ignite-fall-2021
15
14
16
15
This article shows you how to securely and seamlessly create an SSH connection to your Linux VMs located in an Azure virtual network directly through the Azure portal. When you use Azure Bastion, your VMs don't require a client, agent, or additional software. You can also connect to a Linux VM using RDP. For information, see [Create an RDP connection to a Linux VM](bastion-connect-vm-rdp-linux.md).
17
16
18
-
Azure Bastion provides secure connectivity to all of the VMs in the virtual network in which it is provisioned. Using Azure Bastion protects your virtual machines from exposing RDP/SSH ports to the outside world, while still providing secure access using RDP/SSH. For more information, see the [What is Azure Bastion?](bastion-overview.md).
17
+
Azure Bastion provides secure connectivity to all of the VMs in the virtual network in which it's provisioned. Using Azure Bastion protects your virtual machines from exposing RDP/SSH ports to the outside world, while still providing secure access using RDP/SSH. For more information, see the [What is Azure Bastion?](bastion-overview.md) overview article.
19
18
20
-
When connecting to a Linux virtual machine using SSH, you can use both username/password and SSH keys for authentication. You can connect to your VM with SSH keys by using either:
21
-
22
-
* A private key that you manually enter
23
-
* A file that contains the private key information
19
+
When connecting to a Linux virtual machine using SSH, you can use both username/password and SSH keys for authentication.
24
20
25
21
The SSH private key must be in a format that begins with `"-----BEGIN RSA PRIVATE KEY-----"` and ends with `"-----END RSA PRIVATE KEY-----"`.
26
22
@@ -41,72 +37,121 @@ In order to make a connection, the following roles are required:
41
37
In order to connect to the Linux VM via SSH, you must have the following ports open on your VM:
42
38
43
39
* Inbound port: SSH (22) ***or***
44
-
* Inbound port: Custom value (you will then need to specify this custom port when you connect to the VM via Azure Bastion)
40
+
* Inbound port: Custom value (you'll then need to specify this custom port when you connect to the VM via Azure Bastion)
45
41
46
42
> [!NOTE]
47
43
> If you want to specify a custom port value, Azure Bastion must be configured using the Standard SKU. The Basic SKU does not allow you to specify custom ports.
48
44
>
49
45
50
-
## <aname="username"></a>Connect: Using username and password
46
+
## Bastion connection page
51
47
52
-
1.Open the [Azure portal](https://portal.azure.com). Go to the virtual machine that you want to connect to, then click**Connect** and select **Bastion** from the dropdown.
48
+
1.In the [Azure portal](https://portal.azure.com), go to the virtual machine that you want to connect to. On the**Overview** page, select **Connect**, then select **Bastion** from the dropdown to open the Bastion connection page. You can also select **Bastion** from the left pane.
53
49
54
50
:::image type="content" source="./media/bastion-connect-vm-ssh-linux/connect.png" alt-text="Screenshot shows the overview for a virtual machine in Azure portal with Connect selected" lightbox="./media/bastion-connect-vm-ssh-linux/connect.png":::
55
51
56
-
1. After you select Bastion, click **Use Bastion**. If you didn't provision Bastion for the virtual network, see [Configure Bastion](./quickstart-host-portal.md).
57
-
1. On the **Connect using Azure Bastion** page, enter the **Username** and **Password**.
52
+
1. On the **Bastion** connection page, click the **Connection Settings** arrow to expand all the available settings. If you are using a Bastion **Standard** SKU, you have more available settings than a Basic SKU.
## <aname="privatekey"></a>Connect: Manually enter a private key
105
+
1. To authenticate using a password from Azure Key Vault, configure the following settings:
63
106
64
-
1. Open the [Azure portal](https://portal.azure.com). Go to the virtual machine that you want to connect to, then click **Connect** and select **Bastion** from the dropdown.
107
+
***Protocol**: Select SSH.
108
+
***Port**: Input the port number. Custom port connections are available for the Standard SKU only.
109
+
***Authentication type**: Select **Password from Azure Key Vault** from the dropdown.
110
+
***Username**: Enter the username.
111
+
***Subscription**: Select the subscription.
112
+
***Azure Key Vault**: Select the Key Vault.
113
+
***Azure Key Vault Secret**: Select the Key Vault secret containing the value of your SSH private key.
65
114
66
-
:::image type="content" source="./media/bastion-connect-vm-ssh-linux/connect.png" alt-text="Screenshot of the overview for a virtual machine in Azure portal with Connect selected." lightbox="./media/bastion-connect-vm-ssh-linux/connect.png":::
67
-
1. After you select Bastion, click **Use Bastion**. If you didn't provision Bastion for the virtual network, see [Configure Bastion](./quickstart-host-portal.md).
68
-
1. On the **Connect using Azure Bastion** page, enter the **Username** and **SSH Private Key**.
115
+
* If you didn’t set up an Azure Key Vault resource, see [Create a key vault](../key-vault/secrets/quick-create-powershell.md) and store your SSH private key as the value of a new Key Vault secret.
69
116
70
-
:::image type="content" source="./media/bastion-connect-vm-ssh-linux/ssh-private-key.png" alt-text="Screenshot of SSH Private Key authentication.":::
71
-
1. Enter your private key into the text area **SSH Private Key** (or paste it directly).
72
-
1. Select **Connect** to connect to the VM.
117
+
* Make sure you have **List** and **Get** access to the secrets stored in the Key Vault resource. To assign and modify access policies for your Key Vault resource, see [Assign a Key Vault access policy](../key-vault/general/assign-access-policy-portal.md).
73
118
74
-
## <aname="ssh"></a>Connect: Using a private key file
119
+
> [!NOTE]
120
+
> Please store your SSH private key as a secret in Azure Key Vault using the **PowerShell** or **Azure CLI** experience. Storing your private key via the Azure Key Vault portal experience will interfere with the formatting and result in unsuccessful login. If you did store your private key as a secret using the portal experience and no longer have access to the original private key file, see [Update SSH key](../virtual-machines/extensions/vmaccess.md#update-ssh-key) to update access to your target VM with a new SSH key pair.
121
+
>
75
122
76
-
1.Open the [Azure portal](https://portal.azure.com). Go to the virtual machine that you want to connect to, then click **Connect** and select **Bastion** from the dropdown.
123
+
1.To work with the VM in a new browser tab, select **Open in new browser tab**.
77
124
78
-
:::image type="content" source="./media/bastion-connect-vm-ssh-linux/connect.png" alt-text="Screenshot depicts the overview for a virtual machine in Azure portal with Connect selected." lightbox="./media/bastion-connect-vm-ssh-linux/connect.png":::
79
-
1. After you select Bastion, click **Use Bastion**. If you didn't provision Bastion for the virtual network, see [Configure Bastion](./quickstart-host-portal.md).
80
-
1. On the **Connect using Azure Bastion** page, enter the **Username** and **SSH Private Key from Local File**.
1. Select **Connect** to connect to the VM. Once you click Connect, SSH to this virtual machine will directly open in the Azure portal. This connection is over HTML5 using port 443 on the Bastion service over the private IP of your virtual machine.
129
+
Use the following steps to authenticate using a private key stored in Azure Key Vault.
86
130
87
-
## <aname="akv"></a>Connect: Using a private key stored in Azure Key Vault
1.Open the [Azure portal](https://portal.azure.com). Go to the virtual machine that you want to connect to, then click **Connect** and select **Bastion** from the dropdown.
133
+
1.To authenticate using a private key stored in Azure Key Vault, configure the following settings:
90
134
91
-
:::image type="content" source="./media/bastion-connect-vm-ssh-linux/connect.png" alt-text="Screenshot showing the overview for a virtual machine in Azure portal with Connect selected" lightbox="./media/bastion-connect-vm-ssh-linux/connect.png":::
92
-
1. After you select Bastion, click **Use Bastion**. If you didn't provision Bastion for the virtual network, see [Configure Bastion](./quickstart-host-portal.md).
93
-
1. On the **Connect using Azure Bastion** page, enter the **Username** and select **SSH Private Key from Azure Key Vault**.
135
+
***Protocol**: Select SSH.
136
+
***Port**: Input the port number. Custom port connections are available for the Standard SKU only.
137
+
***Authentication type**: Select **SSH Private Key from Azure Key Vault** from the dropdown.
1. Select the **Azure Key Vault** dropdown and select the resource in which you stored your SSH private key.
142
+
* If you didn’t set up an Azure Key Vault resource, see [Create a key vault](../key-vault/secrets/quick-create-powershell.md) and store your SSH private key as the value of a new Key Vault secret.
97
143
98
-
* If you didn’t set up an Azure Key Vault resource, see [Create a key vault](../key-vault/secrets/quick-create-powershell.md) and store your SSH private key as the value of a new Key Vault secret.
144
+
* Make sure you have **List** and **Get** access to the secrets stored in the Key Vault resource. To assign and modify access policies for your Key Vault resource, see [Assign a Key Vault access policy](../key-vault/general/assign-access-policy-portal.md).
99
145
100
-
* Make sure you have **List** and **Get** access to the secrets stored in the Key Vault resource. To assign and modify access policies for your Key Vault resource, see [Assign a Key Vault access policy](../key-vault/general/assign-access-policy-portal.md).
146
+
> [!NOTE]
147
+
> Please store your SSH private key as a secret in Azure Key Vault using the **PowerShell** or **Azure CLI** experience. Storing your private key via the Azure Key Vault portal experience will interfere with the formatting and result in unsuccessful login. If you did store your private key as a secret using the portal experience and no longer have access to the original private key file, see [Update SSH key](../virtual-machines/extensions/vmaccess.md#update-ssh-key) to update access to your target VM with a new SSH key pair.
148
+
>
101
149
102
-
> [!NOTE]
103
-
> Please store your SSH private key as a secret in Azure Key Vault using the **PowerShell** or **Azure CLI** experience. Storing your private key via the Azure Key Vault portal experience will interfere with the formatting and result in unsuccessful login. If you did store your private key as a secret using the portal experience and no longer have access to the original private key file, see [Update SSH key](../virtual-machines/extensions/vmaccess.md#update-ssh-key) to update access to your target VM with a new SSH key pair.
104
-
>
150
+
***Azure Key Vault Secret**: Select the Key Vault secret containing the value of your SSH private key.
1. To work with the VM in a new browser tab, select **Open in new browser tab**.
107
153
108
-
1. Select the **Azure Key Vault Secret** dropdown and select the Key Vault secret containing the value of your SSH private key.
109
-
1. Select **Connect** to connect to the VM. Once you click **Connect**, SSH to this virtual machine will directly open in the Azure portal. This connection is over HTML5 using port 443 on the Bastion service over the private IP of your virtual machine.
0 commit comments