您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

Azure Cloud Shell 的概述Overview of Azure Cloud Shell

Azure Cloud Shell 是一个用于管理 Azure 资源的交互式的可通过浏览器访问的 shell。Azure Cloud Shell is an interactive, browser-accessible shell for managing Azure resources. 它使用户能够灵活选择最适合自己工作方式的 shell 体验。It gives you the flexibility of choosing the shell experience that best suits the way you work. Linux 用户可以选择 Bash 体验,Windows 用户可以选择 PowerShell。Linux users can opt for a Bash experience, while Windows users can opt for PowerShell.

通过 Azure 门户中的 Cloud Shell 图标启动:Launch via Azure portal from the Cloud Shell icon:

门户启动

利用 Bash 或 PowerShell 中的 shell 选择器下拉列表:Leverage Bash or PowerShell from the shell selector dropdown:

Cloud Shell 中的 Bash

PowerShell in Cloud Shell(预览版)

功能Features

基于浏览器的 shell 体验Browser-based shell experience

Cloud Shell 能够访问以执行 Azure 管理任务为宗旨构建的基于浏览器的命令行体验。Cloud Shell enables access to a browser-based command-line experience built with Azure management tasks in mind. 利用 Cloud Shell 可以不受限制地以只有云才能提供的方式从本地计算机工作。Leverage Cloud Shell to work untethered from a local machine in a way only the cloud can provide.

选择偏好的 shell 体验Choice of preferred shell experience

Azure Cloud Shell 使用户能够灵活选择最适合自己工作方式的 shell 体验。Azure Cloud Shell gives you the flexibility of choosing the shell experience that best suits the way you work. Linux 用户可以选择 Bash in Cloud Shell,而 Windows 用户可以选择 PowerShell in Cloud Shell(预览版)。Linux users can opt for Bash in Cloud Shell, while Windows users can opt for PowerShell in Cloud Shell (Preview).

经身份验证的已配置 Azure 工作站Authenticated and configured Azure workstation

Cloud Shell 由 Microsoft 管理,因此预装了常用的命令行工具和语言支持,可以提高工作速度。Cloud Shell comes managed by Microsoft so it is pre-installed with popular command-line tools and language support so you can work faster. 此外,Cloud Shell 能够安全地自动执行身份验证以立即通过 Azure CLI 2.0 或 Azure PowerShell cmdlet 访问资源。Additionally, Cloud Shell securely authenticates automatically for instant access to your resources through the Azure CLI 2.0 or Azure PowerShell cmdlets.

查看 Bash 体验PowerShell(预览版)体验的完整工具列表。View the full tooling list for the Bash experience and PowerShell (Preview) experience.

多个访问点Multiple access points

除了从 Azure 门户访问以外,还可从以下位置访问 Cloud Shell:In addition to Cloud Shell being available from the Azure portal, it can also be accessed from:

连接 Microsoft Azure 文件存储Connect your Microsoft Azure Files storage

Cloud Shell 计算机是临时的,因此需要装载 Azure 文件共享作为 clouddrive 来持久保存 $Home 目录。Cloud Shell machines are temporary and as a result require an Azure Files share to be mounted as clouddrive to persist your $Home directory. 首次启动时,Cloud Shell 会提示将替你创建资源组、存储帐户和 Azure 文件共享。On first launch Cloud Shell prompts to create a resource group, storage account, and an Azure file share on your behalf. 这是一个一次性步骤,将来会针对所有会话自动附加。This is a one-time step and will be automatically attached for all sessions. 单个 Azure 文件共享可以映射,将 Bash 和 PowerShell in Cloud Shell(预览版)使用。A single Azure file share can be mapped and will be used by both Bash and PowerShell in Cloud Shell (Preview).

创建新存储Create new storage

系统可代你创建本地冗余存储 (LRS) 帐户和 Azure 文件共享。A locally-redundant storage (LRS) account and Azure Files share can be created on your behalf. 如果选择同时使用 Bash 和 PowerShell 环境,Azure 文件共享将用于这两种环境。The Azure Files share will be used for both Bash and PowerShell environments if you choose to use both. 将收取常规存储费用。Regular storage costs apply.

将替你创建以下三个资源:Three resources will be created on your behalf:

  1. 资源组:cloud-shell-storage-<region>Resource Group named: cloud-shell-storage-<region>
  2. 存储帐户:cs<uniqueGuid>Storage Account named: cs<uniqueGuid>
  3. 文件共享:cs-<user>-<domain>-com-<uniqueGuid>File Share named: cs-<user>-<domain>-com-<uniqueGuid>

备注

Cloud Shell 中的 Bash 还会创建一个默认的 5-GB 磁盘映像用于持久保存 $HomeBash in Cloud Shell also creates a default 5-GB disk image to persist $Home. $Home 目录中的所有文件(如 SSH 密钥)将持久保存在已装载的 Azure 文件共享中存储的用户磁盘映像中。All files in your $Home directory such as SSH keys are persisted in your user disk image stored in your mounted Azure file share. 在 $Home 目录和已装载的 Azure 文件共享中保存文件时,请应用最佳做法。Apply best practices when saving files in your $Home directory and mounted Azure file share.

使用现有资源Use existing resources

提供了一个高级选项用于将现有资源关联到 Cloud Shell。An advanced option is provided to associate existing resources to Cloud Shell. 在存储设置提示下,单击“显示高级设置”显示其他选项。At the storage setup prompt, click "Show advanced settings" to show additional options. 从下拉列表筛选分配的 Cloud Shell 区域和本地/全局冗余存储帐户。Dropdowns are filtered for your assigned Cloud Shell region and locally/globally-redundant storage accounts.

了解 Cloud Shell 存储、更新 Azure 文件共享和上传/下载文件。Learn about Cloud Shell storage, updating Azure file shares, and uploading/downloading files.

概念Concepts

  • Cloud Shell 在按会话按用户提供的临时主机上运行Cloud Shell runs on a temporary host provided on a per-session, per-user basis
  • Cloud Shell 在 20 分钟没有交互活动后将超时Cloud Shell times out after 20 minutes without interactive activity
  • Cloud Shell 需要装载 Azure 文件共享Cloud Shell requires an Azure file share to be mounted
  • Cloud Shell 对 Bash 和 PowerShell 使用相同的 Azure 文件共享Cloud Shell uses the same Azure file share for both Bash and PowerShell
  • 将针对每个用户帐户为 Cloud Shell 分配一台计算机Cloud Shell is assigned one machine per user account
  • 在 Bash 中权限是按常规 Linux 用户设置的Permissions are set as a regular Linux user in Bash

详细了解 Bash in Cloud ShellPowerShell in Cloud Shell(预览版)的功能。Learn more about features in Bash in Cloud Shell and PowerShell in Cloud Shell (Preview).

示例Examples

  • 使用脚本将 Azure 管理任务自动化Use scripts to automate Azure management tasks
  • 通过 Azure 门户和 Azure 命令行工具同时管理 Azure 资源Simultaneously manage Azure resources via Azure portal and Azure command-line tools
  • 体验 Azure CLI 2.0 或 Azure PowerShell cmdletTest-drive Azure CLI 2.0 or Azure PowerShell cmdlets

Bash in Cloud ShellPowerShell in Cloud Shell(预览版)的快速入门中尝试这些示例。Try out these examples in quickstarts for Bash in Cloud Shell and PowerShell in Cloud Shell (Preview).

定价Pricing

托管 Cloud Shell 的计算机是免费的,先决条件是具有已装载的 Azure 文件共享。The machine hosting Cloud Shell is free, with a pre-requisite of a mounted Azure Files share. 将收取常规存储费用。Regular storage costs apply.

后续步骤Next steps

Bash in Cloud Shell 快速入门Bash in Cloud Shell quickstart
PowerShell in Cloud Shell(预览版)快速入门PowerShell in Cloud Shell (Preview) quickstart