系统极客一直在努力
专注操作系统及软件使用技能

Azure PowerShell 1.0 Preview预览版发布

Azure PowerShell 1.0 Preview预览版发布

微软已将 Azure PowerShell 1.0 Preview 发布到了 PowerShell Gallery,此次发布的预览版有许多变化,微软主要用其来收集反馈意义并纳入到正式的 Azure PowerShell 1.0 中。

注意:此预览版不适合用于关键业务,如果你在生产环境中进行使用,建议还是保留在 Azure PowerShell 0.9.8 版本。

Azure PowerShell 团队对 Azure PowerShell 1.0 的功能更新主要如下:

  • 更好的支持 Azure Automation 的 Resource Manager 功能
  • 单独的 Azure 服务管理和 Resource Manager 功能,相关 Azure cmdlets 更有条理和易用
  • Azure PowerShell 通过 WebPI 和 PowerShell Gallery 完成新功能的更快交付
  • 自动化的 Azure PowerShell MSDN 参考文档

安装和导入Azure PowerShell 1.0 Preview

要安装 Azure PowerShell 1.0 Preview 需要用到 PowerShellGet,因此需要提前安装 Windows Management Framework 5.0 (Windows 10默认已集成)。

使用 PowerShellGet 安装 Azure PowerShell 1.0 Preview 的命令如下:

# 通过 PowerShell Gallery 安装 Azure Resource Manager modules
Install-Module AzureRM
Install-AzureRM

# 通过 PowerShell Gallery 安装 Azure Service Management module
Install-Module Azure

完成 Azure PowerShell 1.0 Preview 安装之后,即可导入 Azure 和 AzureRM modules。

# 导入 AzureRM.* modules
Import-AzureRM

# 单独导入 AzureRM module
Import-Module AzureRM.Compute

# 导入 Azure Service Management
Import-Module Azure

使用 Resource Manager

# 登录到 Azure Resource Manager
Login-AzureRmAccount

# 查看所有订阅
Get-AzureRmSubscription

# 设定当前会话下的默认订阅
Get-AzureRmSubscription –SubscriptionName “your sub” | Select-AzureRmSubscription

# 选择当前会议的默认存储
Set-AzureRmCurrentStorageAccount –ResourceGroupName “your resource group” –StorageAccountName “your storage account name”

# 导入 Azure.Storage 模块
Import-Module Azure.Storage

# 列出所有容器下的 blobs
Get-AzureRmStorageAccount | Get-AzureStorageContainer | Get-AzureStorageBlob

使用 Service Management

# 导入 Azure Service Management module
Import-Module Azure

# 登录到 Azure Service Management
Add-AzureAccount

# 列出所有虚拟机
Get-AzureVM
赞(0) 赞赏

评论 抢沙发

微信赞赏