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.
- First step is to open the windows PowerShell window.
- 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.
3. It will check the credentials that you entered and shows the account name after successfully connected.
Now we are connected to our Azure Subscription.
4. Let’s check the details about Azure Subscription
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.
See it list out all the virtual machines associated to current azure subscription.
6. Once we finished, we can remove the azure account.
Remove-AzureAccount –Name ‘AccountName’
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.