有没有办法从 Azure Cloud Shell 下载文件?

Is there a way to download files from Azure Cloud Shell?

我正在尝试获取我的 Azure Kubernetes 集群的凭据。 运行 用于在 Azure 云上获取详细信息的脚本 shell 并获得一个 .config 文件。我想知道是否有办法从我的 Azure Cloud Shell 会话下载文件?

当您使用 Azure Cloud Shell 时,您需要创建一个 Azure 文件共享或使用现有的。 Cloud shell 将文件共享安装到系统。而挂载路径可以使用命令mount查看。结果会像这样:

按照我的建议,您可以将.config文件复制到这样的路径:/home/RG/clouddrive/.cloudconsole,然后您可以从文件共享中下载文件。

更详细的可以看另外一个案例.

在云 shell 提示符下只需键入:download yourfilename

  1. 列出您的文件

Azure Cloud Shell File listing

您可能会注意到 clouddrive 文件夹(查看上图 link)。此文件夹安装到 Azure 文件共享,如此处指定:https://docs.microsoft.com/en-us/azure/cloud-shell/persisting-shell-storage#how-cloud-shell-storage-works

  1. 获取 Azure 文件共享信息:

Azure File Share

使用 Get-CloudDrive 命令,您可以获得 Azure 文件共享元数据,这将帮助您在 Azure 门户中找到文件的下载页面。

  1. 登录到 Azure 门户并找到 Azure 文件共享:

Azure File Share at Azure Portal