除了基于 Azure 门户 Web 的 SSH 之外,我如何使用 Azure Bastion 主机登录到 VM?

How can i login to VM using Azure Bastion Host Other than Azure portal web based SSH?

我已经在我的 Azure 订阅中创建了 Azure Baston 主机和 VM,我可以通过提供用户名和密码从 Azure 门户 SSH 到我的 VM,我正在寻找替代的 SSH 方法,例如 CLI SSH。

我不想从 Azure 门户使用基于浏览器的 SSH,请告诉我从 CLI 通过堡垒主机 SSH 到 VM 的任何方法。

据我了解您的要求,这似乎不适用于 Azure Bastion。

根据设计,

Azure Bastion 是一项服务,旨在通过 TLS 直接从 Azure 门户向您的 VM 提供 RDP/SSH 连接。它被设计为 PaaS 服务,完全由平台本身管理。

这是 Azure Bastion 部署的样子:

如上所述,Bastion 主机部署在 VNet 中,用户使用任何 HTML5 浏览器连接到 Azure 门户。

如果这不适合您的用例,您可能必须考虑构建自己的跳转箱并自定义配置您的 NSG 以加强安全性。

Azure Bastion now offers support for connecting to target VMs in Azure using a native RDP or SSH client on your Windows workstation.

Native client support is not yet available for use from your local Linux workstation.

更多信息在这里:https://docs.microsoft.com/en-us/azure/bastion/connect-native-client-windows

az login
az account set --subscription "<subscription ID>"

az network bastion ssh \
  --name "<BastionName>" \
  --resource-group "<ResourceGroupName>" \
  --target-resource-id "<VMResourceId>" \
  --auth-type "ssh-key" \
  --username "<Username>" \
  --ssh-key "<Filepath>"