AzureAD / MSAL.PS

MIT License
159 stars 29 forks source link

System/User Managed Assigned Service Identity Support? #24

Closed JustinGrote closed 3 years ago

JustinGrote commented 3 years ago

I notice this does not have support for Managed Service Identity Scenarios, most common one being Azure Functions with MSI or user-assigned identity support. Is there a particular reason?

If not I can prepare a PR that integrates basically this flow:

function Get-AzMSIAccessToken {
    param (
        $Uri = 'http://169.254.169.254/metadata/identity/oauth2/token?api-version=2018-02-01&resource=https%3A%2F%2Fmanagement.azure.com%2F'
    )
    (Invoke-RestMethod  -Headers @{Metadata='true'} -UseBasicParsing -Uri $uri).access_token
}
jazuntee commented 3 years ago

Hi @JustinGrote, The Managed Service Identity flow shown cannot be accomplished using the MSAL library today and since this module is specific to the MSAL library, it would not be a good candidate for this module. However, it would definitely be a handy snippet or helper function in another module.