Sandeep Wagh
Sandeep Wagh

Reputation: 15

Importing Azure Rm gives me an error

I have a windows 7 Professional SP1 machine and have installed the windows azure poweshell version 3.7.0 and also have installed the azure rm successfully. But whenever i am trying to import the Azure Rm via the admin login i get the following error

PS C:\Users\swagh> Import-Module AzureRM


Import-Module : File C:\Program Files\WindowsPowerShell\Modules\AzureRM\4.2.1\AzureRM.psm1 cannot b
its operation is blocked by software restriction policies, such as those created by using Group Pol
At line:1 char:1
+ Import-Module AzureRM
+ ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [Import-Module], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess,Microsoft.PowerShell.Commands.ImportModuleCommand

I have tried several ways, uninstalling and reinstalling etc...but failed. Can anyone please help me?

Upvotes: 0

Views: 323

Answers (2)

Claim Mathieussika
Claim Mathieussika

Reputation: 1

To fix this you need to change the execution policy by this simple command:

PS c:> Set-ExecutionPolicy RemoteSigned

then reply Y(yes) to the popup to change setting. Now try running again the import command, it will run:

PS c:> Import-Module AzureRM

this worked for me , i hope it helps you too

Upvotes: 0

vonPryz
vonPryz

Reputation: 24071

The answer is right there in the error message, though it's not copied completely from the Powershell console:

Import-Module : ... its operation is blocked by software restriction policies, such as those created by using Group Pol

This means that a domain SRP prevents you loading the module. Contact your domain administrator to discuss SRP settings.

Upvotes: 1

Related Questions