术语“New-AzResourceGroupDeployment”未被识别为 cmdlet、函数的名称

Ard*_*oli 4 powershell azure azure-resource-group

我需要在我的 PowerShell 中运行以下命令:

New-AzResourceGroupDeployment 
    -Name Myrg1010 
    -ResourceGroupName ADFcslResourceGroup 
    -TemplateFile C:\ADFARM.json 
    -TemplateParameterFile C:\ADFARM-Parameters.json
Run Code Online (Sandbox Code Playgroud)

在运行此命令之前,我已连接到 Azure 订阅

Connect-AzAccount
Run Code Online (Sandbox Code Playgroud)

但我有以下错误:

New-AzResourceGroupDeployment : The term 'New-AzResourceGroupDeployment' 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-AzResourceGroupDeployment -Name MyARMDeployment -ResourceGroupNam ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (New- 
   AzResourceGroupDeployment:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Run Code Online (Sandbox Code Playgroud)

我找到了这篇文章,但这不是我的情况,因为我的 powershell 版本是 5.1.2

Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     5.1.2      Azure                               {Get- 
AzureAutomationCertificate, Get-AzureAutomationConnection, New-AzureAuto...
Run Code Online (Sandbox Code Playgroud)

你能告诉我我该怎么办吗?

Sce*_*ist 10

您需要安装 Azure Powershell 模块:

你可以只为这个命令寻找一个:

Install-Module -Name Az.Resources -AllowClobber -Scope CurrentUser
Run Code Online (Sandbox Code Playgroud)

或者所有这些:

Install-Module -Name Az -AllowClobber -Scope CurrentUser
Run Code Online (Sandbox Code Playgroud)

这里了解详细信息


Saj*_*ran 5

每当你收到 cmdlet 错误时,你需要检查模块是否已安装,如评论中所述,尝试安装

Install-Module -Name Az -AllowClobber -Scope CurrentUser
Run Code Online (Sandbox Code Playgroud)

AZ模块