Before we start, make sure that PowerShell is installed on your local machine. If not, please follow the steps mentioned here to install PowerShell.
If you already have PowerShell installed on your machine, make sure that you are using the latest version.
Now, to connect to Azure, install the Azure modules for PowerShell as well. Microsoft has been using the Az
module for a while. To install the Az
module, you need to run the command given below:
Install-Module -Name Az -Scope CurrentUser
If you already have the Az
module installed, then update it by running the command below:
Update-Module -Name Az
You will see various Azure modules getting installed. These include cognitive service, key-vault, and compute, among others. The snapshot given below shows the command prompt for this.
Once the installation is complete, you can run the command below to log in to your Azure account using PowerShell:
az login
You will be prompted to log in to your browser. If the login is successful, you can see the subscription details as shown below:
Now, you are logged in and can easily run all the Azure commands from PowerShell.
Check out my course Build a REST API Using Python and Deploy it to Microsoft Azure for additional information on Microsoft Azure services.