- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to connect Azure Account using PowerShell?
To connect the azure account with PowerShell, we can use the Connect-AZAccount command. If we check the command parameters from the below URL, there are multiple methods we can connect to the azure account but in this article, we will use the simple methods to connect.
Using the Interactive console to connect portal
Using DeviceLogin method.
Using Credentials method.
Using the Interactive console method to connect the portal.
When we use the Connect-AZAccount directly without any parameter, it will open a popup for the azure portal credential.
You need to enter your Azure credentials there.
Using Device Login method.
In this method, Connect-AZAccount uses the parameter -DeviceLogin. Once you run the command, it will show the code on the console window and that code we need to enter on the website,
WARNING: To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code SAYX4512 to authenticate.
As shown in the above output, you need to enter display code on the website,https://Microsoft.com/DeviceLogin and if you are not already authenticated you need to enter Azure credentials there.
Using Credentials Method.
You can direct provide Azure user credentials in the Get-Credentials command and use those credentials in Connect-AZAccount .
$creds = Get-Credential Connect-AZAccount -Credential $creds
Once you enter the correct credentials, your account will be connected. But if your organization has configured the multi-factor authentication this method won’t work and likely it will produce an error.
- Related Articles
- How to connect to the Azure subscription using Azure CLI in PowerShell?
- How to check which Azure account is logged in using PowerShell?
- How to get the Azure VM storage account type using PowerShell?
- How to log in to the Azure account using Az CLI command in PowerShell?
- How to connect to SSH using PowerShell?
- How to retrieve Azure VMs using PowerShell?
- How to get the currently logged-in user account with Azure CLI in PowerShell?
- How to list the Azure VMs using Azure CLI in PowerShell?
- How to deallocate the Azure VM using Azure CLI in PowerShell?
- How to start the Azure VM using Azure CLI in PowerShell?
- How to stop the Azure VM using Azure CLI in PowerShell?
- How to restart the Azure VM using Azure CLI in PowerShell?
- How to resize the Azure VM using Azure CLI in PowerShell?
- How to Export the Azure VMs using PowerShell?
- How to get the Azure resource group using Azure CLI in PowerShell?