


automating Azure, you're probably going to be connecting interactively using a username and password. In this article, you're going to learn the top two most common methods - interactively using a username/password and using a service principal. There are currently five ways to authenticate to Azure with PowerShell: How you choose to do so depends on the context in which your PowerShell script is running. There are lots of ways to authenticate to Azure using Connect-AzAccount. When in doubt, just use Connect-AzAccount. All three commands are actually just one. Both Login-AzAccount and Add-AzAccount are both PowerShell aliases. Actually, you just need one - Connect-AzAccount. You don't have to memorize all three commands. If you've searched online for "how to connect to Azure with PowerShell", you've probably come across blog articles and forum posts that demonstrate connecting with seemingly three different cmdlets.ĭon't fret. Just like with the Azure portal, you must first provide some kind of credentials.Īssuming you already have the Az module installed and a PowerShell console up, let's get started understanding how Azure authentication works in PowerShell and how to do it. For this article in our Getting Started with PowerShell series, we're going to take the skills you've learned so far and actually do something useful with them authenticate to Azure.Īuthenticating to Azure with PowerShell is the first step you must do before much of anything can happen. You've got some PowerShell skills, an Azure subscription and a mad hankering to automate some boring stuff. Running PowerShell Commands and Getting Help Installing PowerShell and Visual Studio Code Windows PowerShell, PowerShell Core and PowerShell: Huh? If you'd like to catch up (or skip ahead), click on the appropriate post below.

*If you're just joining us, this post is part of a series on Getting Started with PowerShell.
