Azure PowerShell无法连接

时间:2016-02-04 02:35:39

标签: powershell azure azure-powershell

我已按照MS说明下载并安装了Azure Powershell: https://azure.microsoft.com/en-us/documentation/articles/powershell-install-configure/

使用Windows Powershell ISE我运行命令:

登录-AzureRmAccount

返回错误:

Login-AzureRmAccount : The 'Login-AzureRmAccount' command was found in the module 'AzureRM.Profile', but the  module could not be loaded. For more information, run 'Import-Module AzureRM.Profile'. At line:1 char:1
+ Login-AzureRmAccount
+ ~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Login-AzureRmAccount:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule

导入模块AzureRM.Profile

返回此错误:

Import-Module : File C:\Program Files (x86)\Microsoft 
SDKs\Azure\PowerShell\ResourceManager\AzureResourceManager\AzureRM.Profile\CheckVersions.ps1 cannot be loaded 
because running scripts is disabled on this system. For more information, see about_Execution_Policies at 
http://go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ Import-Module AzureRM.Profile
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [Import-Module], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.ImportModuleCommand

为什么连接到Azure这么困难,可能出现什么问题?

1 个答案:

答案 0 :(得分:17)

从命令提示符运行:

powershell Set-ExecutionPolicy RemoteSigned