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

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

我低于错误

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

如果我尝试 运行 Import-Module AzureRM.ServiceBus 我得到以下错误

模块清单中的成员 'FormatsToProcess' 无效:无法找到路径 'C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureRM.ServiceBus.\Microsoft.Azure.Commands.ServiceBus.format.ps1xml',因为它不存在。请确保在文件 'C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureRM.ServiceBus\AzureRM.ServiceBus.psd1'.

按照 Error loading azure.profile in 1.0.5 上的建议,我使用“Install-Module AzureRM -Verbose -Force”重新安装了 azure PowerShell。之后 New-AzureRmServiceBusNamespace 被识别但低于错误

"The term 'Login-AzureRmAccount' is not recognized as the name of a cmdlet, function, script file, or operable program.".

修复此错误的解决方案是使用 MSI 重新安装 Azure PowerShell。之后 Login-AzureRmAccount 被识别,但 New-AzureRmServiceBusNamespace 再次丢失。我在兜圈子。

我必须让 New-AzureRmServiceBusNamespace 在不中断 Login-AzureRmAccount 的情况下工作。请帮助我。

我会删除由 msi(完全)安装的 Azure powershell 并重新启动,之后我会检查 C:\Program Files\WindowsPowerShell\Modules 目录并从那里删除所有与 Azure 相关的模块。在那之后,我会做 Install-Module AzureRM

请先检查您的 Azure PowerShell 版本,您可以使用以下 cmdlet。

Get-Module -ListAvailable -Name Azure -Refresh

我的版本是3.6.0。 New-AzureRmServiceBusNamespaceLogin-AzureRmAccount 都适合我。如果你的版本不是最新的,我建议你可以更新你的版本到最新的。你可以从这个link.

下载PS版本3.6.0安装文件

评论更新:

当 OP 将他的笔记本电脑从 Windows 7 升级到 Windows 10 时,它工作正常。