术语 'New-AzureVirtualNetwork' 未被识别为 cmdlet、函数、脚本文件或可运行程序的名称

The term 'New-AzureVirtualNetwork' is not recognized as the name of a cmdlet, function, script file, or operable program

我正在编写 PowerShell 以获取本地 .vhd 图像,将其上传到存储帐户,并基于它创建 VM。我所做的一切都是新 "Resource Manager" 与经典

目前一切正常。我可以创建资源组、存储帐户、容器等。所有这些 commandlet 都很好,并且按预期工作。

我正在尝试为 VM 创建网络适配器。作为其中的一部分,我正在尝试创建一个新的虚拟网络。我在网上找到的每个指南都说要使用 "New-AzureVirtualNetwork",但对我来说似乎不存在。

我是否需要安装一个额外的包来创建与 Azure CLI 的其余部分不同的虚拟网络,或者它是否已重命名或最新版本中的某些内容但我没有关注正确的文档?

错误如下:

New-AzureVirtualNetwork : The term 'New-AzureVirtualNetwork' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ New-AzureVirtualNetwork
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (New-AzureVirtualNetwork:String) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : CommandNotFoundException

我找到了问题的答案。似乎每当你 post 一个问题,通常马上就会找到答案 :-)。

对于资源管理器,命令是:

New-AzureRmVirtualNetwork

如果它不能正常工作,只需将 Rm 添加到几乎每个命令,并且大多数旧代码都可以工作。

由于您使用的是 ARM,因此您应该可以访问 New-AzureRmVirtualNetwork