Reputation: 15
I am using Azure function Authentication, I can see 2 selections: Authentication and Authentication(classic) which one should I use? Currently I am using Authentication, not the classic one and I use Microsoft as IDP: created a new app for it. Seems it works and each time I access my Azure function, I got 401 error. So the question comes: How can I pass this Auth? should I use a token or something like that? I can't find a doc about it. Thanks!
Upvotes: 0
Views: 128
Reputation: 12153
I think you are in the right direction, Authentication(classic) of Azure function is an old version. It is recommended to use the new one.
If you want to access the Azure function that protected by Authentication(Azure AD App), you need to request an access token for it. Try the steps below:
access_as_user
so that your SPA could require an access token for this scope:Click the grant admin consent button to finish the process.
MsalService
to acquire an access token with scope: api://<your azure function app id>/access_as_user
, by this token, you can access your Azure function. For a quick test, I just test it in postman and it works perfectly:Upvotes: 1