Azure PowerShell Login Issue


At times we face issues while logging in to Azure PowerShell. There may be different types of error messages while logging in. This article explains about the resolution of the error message “The PowerShell session has not been properly initialized. Please import the module and try again."

Azure PowerShell

This error message appears in certain cases like, the module is not installed/imported successfully or the Windows PowerShell is not updated successfully. The below steps helps to resolve this issue.



Check the PowerShell Version by executing the below command,




Azure PowerShell


Verify the PowerShell module list to understand the list of Azure PowerShell module installed\imported.

Azure PowerShell

The AzureRm.Profile is an important module using which the latest Azure resources can be managed through the PowerShell. Here the AzureRM Module is not installed/Imported.

In order to rectify the issue, the existing Azure PowerShell module(s) should be clean wiped and to be reinstalled.


Check the Azure PowerShell module directory location by executing the following command

Get-Module AzureRM –ListAvailable| Select-Object Name,Version,Path

Azure PowerShell

Here we notice that the earlier version of Azure PowerShell Module is installed. Note the path of Azure PowerShell module.

Change the PowerShell Session to the Azure Module path by executing the following command.

Cd “C:\Program Files\WindowsPowerShell\Modules\AzureRM\4.0.2\”

Azure PowerShell


Execute the below Command to uninstall the existing Azure PowerShell module.

Get-Module azure* -ListAvailable | Uninstall-Module

Azure PowerShell

This command uninstalls all the Azure related PowerShell modules.

If any of the Azure module(s) is not uninstalled, change the PowerShell session to different path and execute the command once again.

Step 5

Verify whether the Azure PowerShell module(s) are uninstalled successfully by executing the below command.


Azure PowerShell


Follow the steps mentioned in my previous article to install and import the Azure PowerShell module.


Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now