Development · Microsoft Azure · Windows Powershell

Connect to Microsoft Azure Subscription using Windows PowerShell – Part 1

Hello friends, in this blog we will learn how we can connect to Azure Subscription using PowerShell.

As you know we can also perform the operations from PowerShell window which we can do using management portal.

We can connect to the Azure subscription from windows PowerShell in 2 ways:

  • Importing license setting file
  • Adding Azure account

In this blog we will cover connecting to azure using license setting file. Connect to Azure using license setting file method takes 2-3 steps more than directly adding azure account method.

First step is to get the Azure Publish setting file from Microsoft website.

  1. Open the Windows PowerShell window. If you don’t have installed windows PowerShell then you can download from Microsoft download library, it’s easy.
  2. Type the command Get-AzurePublishSettingsFile. Press Enter key.

1

3. Microsoft site gets opened and asked you credentials to download the setting for that account. A file gets downloaded to your local system with extension of publishsettings.

E.g. Pay-As-You-Go-8-1-2017-credentials.publishsettings

2

4. Once we download that file, we need to import that setting file which contains information about your azure subscription.

5. Type the command Import –AzurePublishSettingsFile ‘location of publish setting file’

3

Now we have imported the settings from that file and we are connected to our Azure subscription now.

6. Let’s check the details about our Azure Subscription

Get-AzureSubscription

4

It tells about the details of azure subscription like subscription id, subscription name,default account, etc.

7. Subscription details we get are same and we can check these from Azure management portal.

5

8. Similary we can also check the details about the virtual machines we have in our subscription.

Type the command –

Get-AzureVM

Typing above command did not returned any information as we are connected using Resource manager mode.

Get-AzureRMVM

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

6

So, this is the first method that we learnt today using importing license setting file to connect to our azure subscription 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