How to connect to Azure from PowerShell Core

I got queries from many beginners to know how they can connect Azure from PowerShell. I am assuming you have already installed the Az Module and using PowerShell Core. Here is the simple command for your reference. The below command will connect to your Azure Account and it will connect to the default subscription.


And if you have different subscriptions you have to set the default subscription with the below command.

Set-AzContext ‘Visual Studio Enterprise’

To Discover or list all the Az Module

Get-Module Az.* -ListAvailable | Select-Object Name -Unique

To discover the available cmdlets within a module we can use the Get-Command cmdlet. In this example we browse all cmdlets within the Az.Account module:

Get-Command -Module Az.Accounts

You can use the get-Help command to get the help about any specific command

Get-Help Get-AzVM

If want to see a few examples against this command you can use this.

Get-Help Get-AzVM -Examples

The complete Az Module Reference can be found here