【问题标题】:The term 'New-AzResourceGroupDeployment' is not recognized as the name of a cmdlet, function术语“New-AzResourceGroupDeployment”未被识别为 cmdlet、函数的名称
【发布时间】:2019-10-31 15:20:01
【问题描述】:

我需要在我的 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...

你能告诉我该怎么做吗?

【问题讨论】:

  • 您是否安装了模块 Az 资源?

标签: azure powershell azure-resource-group


【解决方案1】:

您需要安装 Azure Powershell 模块:

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

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

或全部:

Install-Module -Name Az -AllowClobber -Scope CurrentUser

详情请见here

【讨论】:

    【解决方案2】:

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

    Install-Module -Name Az -AllowClobber -Scope CurrentUser
    

    Az Module

    【讨论】:

      猜你喜欢
      • 2019-11-13
      • 1970-01-01
      • 2014-08-25
      • 2021-08-19
      • 1970-01-01
      • 2022-08-19
      • 2021-12-22
      • 2019-10-12
      • 2017-12-11
      相关资源
      最近更新 更多