Microsoft Azure · Windows Powershell

Connect to Microsoft Azure Subscription using Windows PowerShell – Part 2

In my previous blog we learnt to connect to Azure subscription by importing azure license setting file. In this blog we will learn an easier method of connecting to azure subscription using Add account method using windows PowerShell.

  1. First step is to open the windows PowerShell window.
  2. Type the command Add-AzureAccount. Press Enter key.

A window gets pop up asking you to enter your Microsoft credential to login to azure portal.

8

3. It will check the credentials that you entered and shows the account name after successfully connected.

9

Now we are connected to our Azure Subscription.

4. Let’s check the details about Azure Subscription

Get-AzureSubscription

10

We will get the same output as we get when we connect to azure using license setting method telling the details of azure subscription like subscription id, subscription name, default account, etc.

5. Similarly we can also check the details about the virtual machines we have in our subscription.

Get-AzureRMVM

See it list out all the virtual machines associated to current azure subscription.

6

6. Once we finished, we can remove the azure account.

Remove-AzureAccount –Name ‘AccountName’

11

It will disconnect you from azure portal and makes PowerShell forgot about the subscription that you were connected.

So, this is the second method we learnt today to connect to our azure subscription using AddAcount method from Windows PowerShell.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s