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.
- Open the Windows PowerShell window. If you don’t have installed windows PowerShell then you can download from Microsoft download library, it’s easy.
- Type the command Get-AzurePublishSettingsFile. Press Enter key.
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.
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’
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
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.
8. Similary we can also check the details about the virtual machines we have in our subscription.
Type the command –
Typing above command did not returned any information as we are connected using Resource manager mode.
See it list out all the virtual machines associated to current azure subscription.
So, this is the first method that we learnt today using importing license setting file to connect to our azure subscription from Windows PowerShell.