2

I'm trying to install Azure Powershell, following the instructions on this page.

The installation seems to run fine and proceeds without errors.

However, once it's finished, I can't manage to find the Azure Powershell application. I dispose of various terminals

  • Windows Azure Command Prompt
  • Windows Azure Storage Command line

But none of these seems to work. By work, I mean successfully run the first command in the example :

Add-AzureAccount

When I do, it gives me the following error :

'Add-Azure Account' is not recognized as an internal control 
or external, operable program or batch file.

On top of that, I see no mention of azure Powershell in my "All installed softwares" list :

enter image description here

I can run the following commands successfully :

Import-Module MSOnline
Get-Module MSOnline 
    gives me -> Manifest   MSOnline                  {Add-MsolRoleMember, Remove-MsolForeignGroupFromRole, Get-MsolFederation...

However, the following command gives all the same error (ModuleNotFound) :

Import-Module Azure
Import-Module AzureResourceManager
Import-Module AzureProfile

It's quite logical since they don't appear in my module list :

PS C:\Users\matthews> Get-Module -ListAvailable

ModuleType Name                      ExportedCommands
---------- ----                      ----------------
Manifest   AppLocker                 {}
Manifest   BitsTransfer              {}
Manifest   MSOnline                  {}
Manifest   MSOnlineExtended          {}
Manifest   PSDiagnostics             {}
Manifest   PSReadline                {}
Manifest   TroubleshootingPack       {}

To conclude, the solution provided here doesn't work, as there is no PowerShell directory in the Windows Azure folder.

Am I misunderstanding something, or is this a problem caused by the installation ?

NB : I also tried to install it using the standalone installer, but in this case, I get an explicit error message :

This setup requires the Windows PowerShell 3.0 or compatible version to be installed.

I'm having troubles installing the new Powershell version for various reasons, but it may be the solution.

merours
  • 65

2 Answers2

0

I think you need to run "Connect-AzAccount" instead of "Add-AzAccount".

command documentation: https://learn.microsoft.com/en-us/powershell/module/az.accounts/connect-azaccount?view=azps-12.2.0

SodaCris
  • 111
0

The command

Import-Module "C:\Program Files (x86)\Microsoft SDKs\..."

Can work but the path has changed in the time.

You probably just need to reboot, so the $env:PSModulePath will be updated.

BUT if you when a quick fix without the need to reboot you could run this script it will do the trick.

if( (Get-Module -ListAvailable azure | measure).Count -eq 0 )
{
    # == Refresh the Environment variable if just intall the tools without rebooting and try again
    $env:PSModulePath = [System.Environment]::GetEnvironmentVariable("PSModulePath","Machine")

    if( (Get-Module -ListAvailable azure | measure).Count -eq 0 )
    {
        echo("You must install the Azure PowerShell Tools. Go at: http://go.microsoft.com/?linkid=9811175&clcid=0x409")
        Read-Host "Press enter key to close"
        exit
    }
}

echo("Azure PowerShell is installed")

I hope this helps.