Skip to content

A PowerShell module to handle authentication for Azure.

License

Notifications You must be signed in to change notification settings

PalmEmanuel/AzAuth

Repository files navigation

AzAuth

AzAuth AzAuthDownloads

AzAuth is a lightweight PowerShell module to handle Azure authentication, using the Azure.Identity MSAL library.

Installation

AzAuth is published to PowerShell Gallery and can be installed with a simple command.

Install-Module -Name AzAuth

Using AzAuth

AzAuth supports multiple ways of getting an access token for a user or identity.

The simplest way is to just run the command, which will look for available tokens among shared tools or sources on the machine.

# Find a token from already authenticated sources like Azure PowerShell or CLI
# Unless otherwise specified, the command uses ".default" as scope, and "https://graph.microsoft.com" as the resource
Get-AzToken

AzAuth implements MSAL and also allows for interactive browser logins, and even persistent credential caches!

Get-AzToken -Interactive -TokenCache 'AzAuthCache'

AzAuth also caches authentications made for the duration of the session even without specifying a cache, so once you've logged in you can get new access tokens without logging in again. No passwords or credentials are stored, only the refresh token as part of the authenticated credential object.

Get-AzToken -Resource 'https://management.azure.com'

For more information, see the help documentation!

Get-Help Get-AzToken -Full

Bug report and feature requests

If you find a bug or have an idea for a new feature, please create an issue in the repo! Before submitting, have a look and see if there are any similar issues already open, in which case you can add to the discussion.

Contribution

If you like AzAuth and want to contribute, you are very welcome to do so! Please read the Contribution Guide to get started!