Easiest ways to get Access Tokens

Came across this post and wanted to bookmark it for myself. Has three ways of getting Access Tokens without any App Registrations.

The first option is a great, I wasn’t aware of it! So simple.

For the second option I use PowerShell. So Get-AzAccessToken it is for me.

Another option I found is to use the Graph PowerShell service principal that gets registered if you have used the Graph cmdlets. It gets installed the first time the cmdlets are used to connect. It’s appId is “14d82eec-204b-4c2f-b7e8-296a70dab67e” so using a function I wrote as part of a previous post I can do the following to get a token:

This is the function for completeness:

Update (4th Nov 2024): Came across this post today. Adding a note here for my reference:

Key thing is you can user Connect-AzAccount to request tokens for other services. I was aware of that, but thought it was limited to Azure items such as Key Vaults etc.