Azure PowerShell is designed for managing and administering Azure resources in command line. Azure PowerShell uses when you build any automation tool which uses azure resources. This article helps you to install and connect azure portal in simple steps. You do not have any prior experience to run PowerShell.
Azure PowerShell works with PowerShell 5.1 or higher. This article demonstrates how to install Azure PowerShell in windows. For other platforms, you need to install PowerShell Core 6.x or later. Refer Install the latest version of PowerShell Core for other platforms
Install PowerShell in Windows
- Open Windows PowerShell App by run at administrator privilege
- Before Installing Azure PowerShell, make sure you already have installed. To verify, run the following command in Windows PowerShell
Get-Module –name Az* -ListAvailable
3. Install the azure module from the PowerShell gallery by the below command
Install-Module -Name Az -AllowClobber
You can run the below command to install only for current user
Install-Module -Name Az -AllowClobber -Scope CurrentUser
4. You will prompt to install NuGet Provider to install. Click Yes to continue install
5. You will be prompted to confirm for installing from untrusted repository. Just click Yes to All. Don’t Panic!!!
6. To verify Azure PowerShell is installed in you machine, run the following command. This will list down all available commands for Azure
Get-Module -Name Az* -ListAvailable
To check the version of Azure Power Module, run the following command
Get-InstalledModule -Name Az -AllVersions
Connect Azure Portal
If you are done with the previous steps, you are ready to connect azure portal via Azure PowerShell
- Run Connect-AzConnect, you will be prompted to login. Type your tenant credentials and you are connected to Azure Portal
2. Other possibilities, sometimes users are login through device login. Just open https://microsoft.com/devicelogin and enter the code generated in your command window
Handling errors during installation
- Cannot be loaded because running script is disabled on this system:
You may get this error if you restrict users do not execute any PowerShell command in the current system.
- In the run, type “gpedit” or type simply “group policy” group policy editor will open
- In the group policy window, Browse to Local Computer Policy -> Computer Configuration -> Administrative Templates -> Windows Components -> Windows PowerShell
- Enable “Turn on Script Execution“
- Set the policy as needed. I set mine to “Allow all scripts”. You all set to run PowerShell script Now!!