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

PowerShell in Azure Cloud Shell(预览版)的功能和工具Features & tools for PowerShell in Azure Cloud Shell (Preview)

Azure Cloud Shell 是一种基于浏览器的 shell 体验,用于管理和开发 Azure 资源。Azure Cloud Shell is a browser-based shell experience to manage and develop Azure resources.

Cloud Shell 提供可通过浏览器访问的预配置 shell 体验,用于管理 Azure 资源,而无需花费自己安装计算机、对其进行版本控制和维护的开销。Cloud Shell offers a browser-accessible, pre-configured shell experience for managing Azure resources without the overhead of installing, versioning, and maintaining a machine yourself.

Cloud Shell 按请求预配计算机,因此计算机状态不会在会话之间保留。Cloud Shell provisions machines on a per-request basis and as a result machine state will not persist across sessions. 由于 Cloud Shell 专为交互式会话构建,因此 shell 在处于非活动状态 20 分钟后会自动终止。Since Cloud Shell is built for interactive sessions, shells automatically terminate after 20 minutes of shell inactivity.

提示

此外还提供 Bash 的功能和工具。Features & tools for Bash is also available.

PowerShell in Cloud Shell(预览版)在 Windows Server 2016 上运行。PowerShell in Cloud Shell (Preview) runs on Windows Server 2016.

功能Features

安全自动身份验证Secure automatic authentication

PowerShell in Cloud Shell(预览版)安全并自动地验证帐户对 Azure PowerShell 的访问权限。PowerShell in Cloud Shell (Preview) securely and automatically authenticates account access for the Azure PowerShell.

不同会话中的文件持久性Files persistence across sessions

要在会话之间保存文件,Cloud Shell 会指导完成在首次启动时附加 Microsoft Azure 文件共享。To persist files across sessions, Cloud Shell walks you through attaching a Microsoft Azure Files share on first launch. 完成后,Cloud Shell 会自动为所有将来的会话附加存储(装载为 $home\clouddrive)。Once completed, Cloud Shell will automatically attach your storage (mounted as $home\clouddrive) for all future sessions. 由于 Cloud Shell 的每个请求分配临时计算机,因此,不同的会话不会持久保存 $home\clouddrive 外部的文件以及计算机状态。Since each request for Cloud Shell is allocating a temporary machine, files outside of your $home\clouddrive and machine state are not persisted across sessions.

详细了解如何将 Azure 文件共享附加到 Cloud ShellLearn more about attaching Azure file shares to Cloud Shell.

Azure 驱动器 (Azure:)Azure drive (Azure:)

PowerShell in Cloud Shell(预览版)启动后,用户会进入 Azure 驱动器 (Azure:) 路径下。PowerShell in Cloud Shell (Preview) starts you in Azure drive (Azure:). 使用 Azure 驱动器可以轻松发现和浏览 Azure 资源,例如计算、网络、存储等,类似于文件系统导航。Azure drive enables easy discovery and navigation of Azure resources such as Compute, Network, Storage etc. similar to filesystem navigation. 可以继续使用熟悉的 Azure PowerShell cmdlet 来管理这些资源。You can continue to use the familiar Azure PowerShell cmdlets to manage these resources. 直接在 Azure 门户中或者通过 Azure PowerShell cmdlet 对 Azure 资源所做的任何更改会立即反映在 Azure 驱动器中。Any changes made to the Azure resources, either made directly in Azure portal or through Azure PowerShell cmdlets, are instantly reflected in the Azure drive.

上下文感知Contextual awareness

  • 资源组范围:在 Azure 驱动器 (Azure:) 中资源组路径的上下文内,资源组名称会自动传递到 Azure PowerShell cmdlet。Resource group scoping: When within the context of a resource group path in the Azure drive (Azure:), the resource group name is automatically passed to the Azure PowerShell cmdlets.

  • Get-AzureRmCommand:此 cmdlet 返回适用于 Azure 驱动器 (Azure:) 位置上下文的命令列表。Get-AzureRmCommand: This cmdlet returns the list of commands applicable in the context of the location under Azure drive (Azure:). 例如,如果用户在 Azure:\<subscription name>\StorageAccounts 下,此 cmdlet 仅显示存储相关的命令For example, it shows only storage-related commands when user is under Azure:\<subscription name>\StorageAccounts

丰富格式的 PowerShell 脚本编辑Rich PowerShell script editing

使用 VIM 编辑 PowerShell 文件 (.ps1,.psm1,.psd1) 时,语法会自动突出显示,并支持 IntelliSense。When you use VIM to edit PowerShell files (.ps1,.psm1,.psd1), you automatically get syntax highlighting and IntelliSense support. IntelliSense 支持是通过可与 PowerShell 编辑器服务的本地实例交互的 vim-plugin 实现的。IntelliSense support is implemented via a vim-plugin that interacts with a local instance of PowerShell Editor Services.

提示

使用 TAB 可填写 (IntelliSense) 命令名称、参数名称和参数值(如果适用)。Use TAB to get completion (IntelliSense) on command names, parameter names, and parameter values (where applicable).

可扩展的模型Extensible model

使用 PowerShellGet,可以轻松地从PowerShell 库安装(和更新)自定义模块与脚本。Using PowerShellGet, you can easily install (and update) custom modules and scripts from the PowerShell Gallery. 安装完成后,模块会自动持久保存在不同的 Cloud Shell 会话中。After installation, your modules are automatically persisted across Cloud Shell sessions.

提示

用户安装的模块保存在 $Home\CloudDrive\.pscloudshell\WindowsPowerShell 文件夹中。Modules installed by users are saved in the $Home\CloudDrive\.pscloudshell\WindowsPowerShell folder. 在用户的 documents 文件夹 ($home\Documents\WindowsPowerShell) 中创建此文件夹的符号链接。A symbolic link for this folder is created in the user's documents folder ($home\Documents\WindowsPowerShell).

来宾 VM 的管理Management of Guest VMs

使用两个内置命令 - Enter-AzureRmVMInvoke-AzureRmVMCommand,可以远程管理 Azure VM。Using two built-in commands - Enter-AzureRmVM and Invoke-AzureRmVMCommand, you can remotely manage your Azure VMs. 这些命令构建在 PowerShell 远程处理的基础之上,需要 PowerShell 与 Azure VM 建立连接。These commands are built on top of PowerShell remoting and require PowerShell connectivity to the Azure VMs.

工具Tools

类别Category NameName
Azure 工具Azure tools Azure PowerShell (5.2.0)Azure PowerShell (5.2.0)
Azure CLI (2.0.26)Azure CLI (2.0.26)
文本编辑器Text editors vimvim
nanonano
包管理器Package Manager PowerShellGetPowerShellGet
PackageManagementPackageManagement
npmnpm
pippip
源代码管理Source control gitgit
数据库Databases SqlServer 模块SqlServer module
sqlcmd 实用工具sqlcmd Utility
测试工具Test tools PesterPester

语言支持Language support

语言Language 版本Version
.NET.NET 4.64.6
Node.jsNode.js 6.106.10
PowerShellPowerShell 5.1 和 6.0.05.1 and 6.0.0
PythonPython 2.72.7

后续步骤Next steps

使用 PowerShell in Cloud Shell(预览版)快速入门Quickstart with PowerShell in Cloud Shell (Preview)

了解 Azure PowerShellLearn about Azure PowerShell