Azure PowerShell will not connect

George Filippakos picture George Filippakos · Feb 4, 2016 · Viewed 12.2k times · Source

I have downloaded and installed the Azure Powershell by following the MS instructions: https://azure.microsoft.com/en-us/documentation/articles/powershell-install-configure/

Using the Windows Powershell ISE I run the command:

Login-AzureRmAccount

which returns the the error:

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

Import-Module AzureRM.Profile

Returns this error:

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

Why is it so difficult to connect to Azure, what could be wrong?

Answer

George Filippakos picture George Filippakos · Feb 4, 2016

From the command prompt run:

powershell Set-ExecutionPolicy RemoteSigned