问题
I was getting below error
The term 'New-AzureRmServiceBusNamespace' is not recognized as the name of a cmdlet, function, script file, or operable program.
If i try to run Import-Module AzureRM.ServiceBus I get below error
The member 'FormatsToProcess' in the module manifest is not valid: Cannot find path 'C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureRM.ServiceBus.\Microsoft.Azure.Commands.ServiceBus.format.ps1xml' because it does not exist.. Please make sure that a valid value is specified for this field in file 'C:\Program Files (x86)\Microsoft SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureRM.ServiceBus\AzureRM.ServiceBus.psd1'.
As suggested on Error loading azure.profile in 1.0.5, I reinstalled azure PowerShell using "Install-Module AzureRM -Verbose -Force". After that New-AzureRmServiceBusNamespace is identified but getting below error
"The term 'Login-AzureRmAccount' is not recognized as the name of a cmdlet, function, script file, or operable program.".
The solution to fix this error is reinstalling Azure PowerShell by using MSI. After that Login-AzureRmAccount is identified but New-AzureRmServiceBusNamespace goes missing again. I'm going in circles.
I've to make New-AzureRmServiceBusNamespace work without breaking Login-AzureRmAccount. Please help me.
回答1:
Please check your Azure PowerShell version firstly, you could use the following cmdlet.
Get-Module -ListAvailable -Name Azure -Refresh
My version is 3.6.0. New-AzureRmServiceBusNamespace
and Login-AzureRmAccount
all work for me. If your version is not latest, I suggest you could update your version to latest. You can download the PS version 3.6.0 installation file from this link.
Update from comment:
When OP upgrade his laptop from Windows 7 to Windows 10, it works fine.
回答2:
I would remove the Azure powershell that was installed by msi (completely) and reboot, after that I'd check C:\Program Files\WindowsPowerShell\Modules
directory and delete all Azure related modules from there. After that, I'd do Install-Module AzureRM
来源:https://stackoverflow.com/questions/42587582/the-term-new-azurermservicebusnamespace-is-not-recognized-as-the-name-of-a-cmd