Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

powershell
azure
communitycreator

How to use PowerShell to connect to Azure

Harsh Jain

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.

Installing the Az Module in PowerShell

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:

Subscription details of your Azure account

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.

RELATED TAGS

powershell
azure
communitycreator
RELATED COURSES

View all Courses

Keep Exploring