Azure PowerShell 别名

Azure PowerShell alias

我看到很多关于 Azure 的问题的答案,答案是你必须执行一系列如下命令:

azure vm image list-publishers westus
azure vm image list-offers westus MicrosoftWindowsServer 
azure vm image list-skus westus MicrosoftWindowsServer WindowsServer 

来自

这只是众多例子中的一个随机例子。

你如何将这样的语句翻译成有效的命令?

我觉得我在环境配置中遗漏了一些步骤。 我刚刚启动了一个普通的 powershell 控制台并正在其中工作。 我没有将任何特定于 azure 的东西导入到控制台中,但是在盒子上安装了 Visual Studio 2017 和最新的 azure sdk。

你必须install the azure cli:

请注意,已经有一个 version 2 的 CLI 使用您可能更喜欢的 az 关键字。

这些命令是不是 Azure PowerShell 命令。正如 Martin 所说,对于 运行 这些命令,您应该安装 CLI 1.0。 我们可以使用 Azure PowerShell 命令获取这些信息:

azure vm image list-publishers westus

Get-AzureRmVMImagePublisher -Location westus

azure vm image list-offers westus MicrosoftWindowsServer

Get-AzureRmVMImageOffer -Location westus -PublisherName MicrosoftWindowsServer

azure vm image list-skus westus MicrosoftWindowsServer WindowsServer

Get-AzureRmVMImageSku -Location westus -PublisherName MicrosoftWindowsServer -Offer WindowsServer