【问题标题】:Connecting VScode to Azure Cloudshell将 VScode 连接到 Azure Cloudshell
【发布时间】:2023-02-18 02:54:08
【问题描述】:

我希望将 VS Code 连接到 Azure Cloudshell,尤其是文件资源管理器组件。

这有点反模式,但 cloudshell 是我能够运行一些连接到 Azure 资源的命令的唯一方式(不允许启动 VM)。

我知道“remote-ssh”扩展可以连接到远程机器并提供一个不错的文件资源管理器,但是,对于 cloudshell,我没有可用的 ssh。但是,可以通过“Azure account”扩展名建立连接。 (还有一个“remote tunnel”扩展,能够通过与 ssh 不同的协议建立连接。)

这是“Azure 帐户”与 cloudshell 建立的连接:

Netid  State   Recv-Q   Send-Q     Local Address:Port          Peer Address:Port          Process  
tcp    ESTAB   0        0          10.xxx.xx.169:http-alt      10.xxx.xx.29:57404            
tcp    ESTAB   0        0          10.xxx.xx.169:51710        20.xxx.xx.200:microsoft-ds

有人知道这是否可用于在连接到 Azure cloudshell 的 VScode 中获得完整的远程开发体验吗?

(我尝试在cloudshell中安装vs code serverrpm包,由于缺少yum和sudo权限而失败。)



回答:TLDR:在浏览器的 azure Cloudshell 中输入 code . 以获取文件编辑器。

(无法使用自己的 IDE,只能使用 cloudshell 作为终端)

【问题讨论】:

    标签: azure visual-studio-code vscode-remote azure-cloud-shell


    【解决方案1】:

    检查以下步骤以连接到Azure Cloud shell (PowerShell/Bash)。

    • 打开VSCode,=>Extensions =>搜索Azure Account。 检查Azure Account是否已安装并启用。

    • 如果未完成,请安装并启用它。

    • 我们需要登录到 Azure 帐户才能打开 Cloud shell。
    • View选项卡=>Command Palette=>Azure: Sign in

    或者

    Ctrl + Shift + P => Azure: Sign in

    • 单击登录并登录到 Azure。

    • 在右侧,单击+ 旁边的dropdown 符号。您将找到Azure Cloud shell (PowerShell / Bash) 的选项。

    • 选择Azure Cloud shell (PowerShell)

    • 如果未登录 Azure,您将获得一个登录选项。

    • 登录后,您将在终端中收到以下消息。

    • 为确保我们已连接到 Azure Cloud shell,请执行任何 PowerShell 命令并检查一次。

    文件浏览器组件

    感谢@Brendan Burn 的帖子。

    关于文件资源管理器,请参阅SO Thread

    【讨论】:

    • 嗨 Harshitha,感谢您提供的信息,这非常有用,只是为了仔细检查:这种方法只允许在 cloudshell 中打开文件编辑器,而不使用我们的标准 IDE,对吗?
    • @Roelof - 是的,你是对的。
    猜你喜欢
    • 1970-01-01
    • 2023-02-10
    • 2021-09-20
    • 2015-12-13
    • 1970-01-01
    • 2015-07-12
    • 2019-06-23
    • 1970-01-01
    • 2023-02-10
    相关资源
    最近更新 更多