How can I get an access token to call an api within a function app?

Justin 1 Reputation point
2022-10-12T21:14:48.107+00:00

I am new to Azure and am having trouble setting up a function app to call a protected api. I need to hit the protected endpoint periodically throughout the day to trigger an event but am having trouble acquiring an access token to send over with the request. I am currently using node as my stack and Azure AD. Is this where I would use managed Identities/Azure Identity Client? I would just like the function to run/ api to be called without any interaction once or twice a day.

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,905 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Takahito Iwasa 4,841 Reputation points MVP
    2022-10-12T21:43:21.707+00:00

    Hi, @Justin

    I understand that you want to call a protected Azure Functions endpoint from outside Azure.

    You can protect your Functions endpoints using keys or authentication/authorization. Consider which to use first according to the following:

    https://learn.microsoft.com/en-us/azure/azure-functions/security-concepts?tabs=v4

    For keys, just embed them into your application. it's simple.

    There are various methods for more secure authentication/authorization.
    If the target is her external web application, it is possible to perform authentication/authorization by integrating the application with Azure AD.

    https://learn.microsoft.com/en-us/azure/active-directory/develop/authentication-flows-app-scenarios