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

k5ifujac  于 2022-11-25  发布在  其他
关注(0)|答案(3)|浏览(218)

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

New-AzResourceGroupDeployment 
    -Name Myrg1010 
    -ResourceGroupName ADFcslResourceGroup 
    -TemplateFile C:\ADFARM.json 
    -TemplateParameterFile C:\ADFARM-Parameters.json

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

Connect-AzAccount

但我有以下错误:

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

我找到了这个article,但这不是我的情况,因为我的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...

请问我该怎么办?

ubof19bj

ubof19bj1#

您需要安装Azure Powershell模块:
您可以只查找此命令的一个:

Install-Module -Name Az.Resources -AllowClobber -Scope CurrentUser

或全部:

Install-Module -Name Az -AllowClobber -Scope CurrentUser

有关详细信息,请参阅here

niknxzdl

niknxzdl2#

无论何时收到cmdlet错误,都需要检查模块是否已安装,如注解中所述,请尝试安装

Install-Module -Name Az -AllowClobber -Scope CurrentUser

Az Module

9rnv2umw

9rnv2umw3#

对我来说,在命令New-AzResourceGroup中有一个拼写错误,纠正它已经修复了。

相关问题