Powershell 登录AzurerAccount:术语';登录AzurerAccount';无法识别为cmdlet、函数、脚本的名称

Powershell 登录AzurerAccount:术语';登录AzurerAccount';无法识别为cmdlet、函数、脚本的名称,powershell,azure,azure-resource-manager,Powershell,Azure,Azure Resource Manager,我对Azure PS模块有问题。我已通过PS gallery安装了以下内容: Install-Module AzureRM Install-Module Azure (并重新启动) 但是,当我运行Login AzureRmAccount时,出现以下错误: 登录AzurerAccount:术语“登录AzurerAccount”不适用 被识别为cmdlet、函数、脚本文件或文件的名称 节目。检查名称的拼写,或者是否包含路径, 请验证路径是否正确,然后重试。第1行字符:1 +登录AzureRmAcc

我对Azure PS模块有问题。我已通过PS gallery安装了以下内容:

Install-Module AzureRM
Install-Module Azure
(并重新启动)

但是,当我运行
Login AzureRmAccount
时,出现以下错误:

登录AzurerAccount:术语“登录AzurerAccount”不适用 被识别为cmdlet、函数、脚本文件或文件的名称 节目。检查名称的拼写,或者是否包含路径, 请验证路径是否正确,然后重试。第1行字符:1 +登录AzureRmAccount + ~~~~~~~~~~~~~~~~~~~~ +CategoryInfo:ObjectNotFound:(登录AzureRmAccount:String)[],CommandNotFoundException +FullyQualifiedErrorId:CommandNotFoundException

我似乎已经安装了所有Azure模块。也就是说,如果我运行
Get模块-List

Script     3.7.0      Azure                               {Get-AzureAutomationCertificate, Get-AzureAutomationConnec...
Script     0.1.0      Azure.AnalysisServices              {Add-AzureAnalysisServicesAccount, Restart-AzureAnalysisSe...
Script     2.7.0      Azure.Storage                       {Get-AzureStorageTable, New-AzureStorageTableSASToken, New...
Script     3.7.0      AzureRM                             {Update-AzureRM, Import-AzureRM, Uninstall-AzureRM, Instal...
Script     0.1.0      AzureRM.AnalysisServices            {Resume-AzureRmAnalysisServicesServer, Suspend-AzureRmAnal...
Script     3.5.0      AzureRM.ApiManagement               {Add-AzureRmApiManagementRegion, Get-AzureRmApiManagementS...
Script     2.7.0      AzureRM.Automation                  {Get-AzureRMAutomationHybridWorkerGroup, Get-AzureRmAutoma...
Script     2.7.0      AzureRM.Backup                      {Backup-AzureRmBackupItem, Enable-AzureRmBackupContainerRe...
Script     2.7.0      AzureRM.Batch                       {Remove-AzureRmBatchAccount, Get-AzureRmBatchAccount, Get-...
Script     2.7.0      AzureRM.Cdn                         {Get-AzureRmCdnProfile, Get-AzureRmCdnProfileSsoUrl, New-A...
Script     0.5.0      AzureRM.CognitiveServices           {Get-AzureRmCognitiveServicesAccount, Get-AzureRmCognitive...
Script     2.8.0      AzureRM.Compute                     {Remove-AzureRmAvailabilitySet, Get-AzureRmAvailabilitySet...
Script     2.7.0      AzureRM.DataFactories               {Remove-AzureRmDataFactory, Get-AzureRmDataFactoryRun, Get...
Script     2.7.0      AzureRM.DataLakeAnalytics           {Get-AzureRmDataLakeAnalyticsDataSource, New-AzureRmDataLa...
Script     3.5.0      AzureRM.DataLakeStore               {Get-AzureRmDataLakeStoreTrustedIdProvider, Remove-AzureRm...
Script     2.7.0      AzureRM.DevTestLabs                 {Get-AzureRmDtlAllowedVMSizesPolicy, Get-AzureRmDtlAutoShu...
Script     2.7.0      AzureRM.Dns                         {Get-AzureRmDnsRecordSet, New-AzureRmDnsRecordConfig, Remo...
Script     0.1.0      AzureRM.EventHub                    {New-AzureRmEventHubKey, Get-AzureRmEventHubNamespace, Get...
Script     2.7.0      AzureRM.HDInsight                   {Get-AzureRmHDInsightJob, New-AzureRmHDInsightSqoopJobDefi...
Script     2.7.0      AzureRM.Insights                    {Get-AzureRmUsage, Get-AzureRmMetricDefinition, Get-AzureR...
Script     1.3.0      AzureRM.IotHub                      {Add-AzureRmIotHubKey, Get-AzureRmIotHubEventHubConsumerGr...
Script     2.7.0      AzureRM.KeyVault                    {Add-AzureKeyVaultCertificate, Set-AzureKeyVaultCertificat...
Script     2.7.0      AzureRM.LogicApp                    {Get-AzureRmIntegrationAccountAgreement, Get-AzureRmIntegr...
Script     0.12.0     AzureRM.MachineLearning             {Move-AzureRmMlCommitmentAssociation, Get-AzureRmMlCommitm...
Script     0.4.0      AzureRM.Media                       {Sync-AzureRmMediaServiceStorageKeys, Set-AzureRmMediaServ...
Script     3.6.0      AzureRM.Network                     {Add-AzureRmApplicationGatewayAuthenticationCertificate, G...
Script     2.7.0      AzureRM.NotificationHubs            {Get-AzureRmNotificationHub, Get-AzureRmNotificationHubAut...
Script     2.7.0      AzureRM.OperationalInsights         {New-AzureRmOperationalInsightsAzureActivityLogDataSource,...
Script     2.7.0      AzureRM.PowerBIEmbedded             {Remove-AzureRmPowerBIWorkspaceCollection, Get-AzureRmPowe...
Script     2.7.0      AzureRM.profile                     {Disable-AzureRmDataCollection, Enable-AzureRmDataCollecti...
...
希望有人能帮忙?使用Powershell 4在Windows Server 2012 R2上运行


关于

您可以使用来自的最新Azure Power Shell版本

注意:请安装3.7.0版本


您需要更新到Azure PowerShell的新版本

  • 使用以下命令:
安装模块AzureRM-AllowClobber


参考文章:

对于我来说,
安装模块
无法识别,我已经安装了Azure 3.7,答案是安装

我在将Powershell脚本作为计划任务运行时遇到了这个问题(使用为运行计划任务保留的用户配置文件)但当以管理员身份从Powershell提示符以交互方式运行时,情况并非如此。(我使用的是Powershell 5.1版。)

Get Module-List
似乎在告诉我,所有用户都已安装了所需的AzureRm模块(在C:\Program Files\WindowsPowerShell\modules下)。然而,它们似乎不是为任务用户安装的

我在计划任务中放置了一个设置例程,以便在任务上下文中运行以下命令:

Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
Install-Module AzureRM.Dns -Scope AllUsers -RequiredVersion 4.0.1 -AcceptLicense
(4.0.1版似乎已经安装)


我还必须使用
Install Module powershell get-Force
来获取
Install Module
的“Scope”参数,以使其被接受。不清楚这三个命令中的哪一个最终起到了作用。

在Powershell中安装Az模块后,我遇到了类似的问题。 在特定会话中,PowerShell可以运行Rm命令或Az命令

要运行RM命令,请执行以下操作:

  • 打开新的Powershell窗口
  • 使用以下命令重新安装AzureRM模块:
安装模块“AzureRM”

  • 像往常一样运行Rm命令

希望这能解决您的问题。

奇怪的是,使用
addazurermaccount
效果很好。仍然有点困惑为什么会发生这种情况你的Azure PowerShell版本是什么?您可以使用cmdlet检查
Get Module-listavable-Name Azure-Refresh
.PS v4。该命令返回:
ModuleType版本名ExportedCommands---------脚本3.7.0 Azure{Get-AzureAutomationCertificate,Get-AzureAutomationConnect…
抱歉我的错误,您的版本是最新的。如果可能的话,我建议您可以尝试使用
*.msi
安装Azure PowerShell。在我的回答中,我给您提供了链接。安装后,您可以重试。我在实验室测试,我的Azure PowerShell
模块类型是
清单
,您的脚本是
脚本
。我认为正确的选项是强制执行命令“Install Module AzureRM-AllowClobber”,并且AllowClobber似乎对本文有效:术语“Install Module”未被识别为cmdlet的名称…请参阅该术语“术语“安装模块”无法识别为cmdlet的名称…”解决方案可在以下位置找到: