Az.Accounts module: setup and commands
Documentation: Microsoft Learn
Connect with Connect-AzAccount, inspect subscriptions with Get-AzSubscription and set the intended tenant and subscription context before Azure changes.
Getting it
Install-PSResource -Name Az.Accounts from the PowerShell Gallery, or take the Az meta-module which includes it. Every other Az module lists it as a required dependency.
Examples
Show reference output
Show reference output
What it is for
Every Az session begins here, and this is where you land when a resource cmdlet complains that no subscription is selected. It also carries the service principal and managed identity sign-in paths that unattended automation depends on.
Typical tasks
- Sign in interactively or with a device code
- Authenticate as a service principal
- Connect using a managed identity
- List and switch between subscriptions
- Save a context for reuse in later sessions
- Acquire a token for a direct REST call
Check the installed version
Compare the module path and version with the session used by your scheduled task or automation account. Every Az session begins here, and this is where you land when a resource cmdlet complains that no subscription is selected. It also carries the service principal and managed identity sign-in paths that unattended automation depends on.