Best ways to authenticate from SPFx app (deployed to Teams) to Azure function

dotnet_guy 15 Reputation points
2024-12-20T16:04:53.2333333+00:00

Hello,

We have an SPFx (React ts) app deployed to teams and trying to authenticate to Azure function deployed on a private endpoint. Are app registrations the only way to authenticate or can we use managed identities? When I allow everything (access) into the function, it works well with API key. But was looking for more secure ways to authenticate.

Thanks.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,248 questions
Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
10,535 questions
Azure
Azure
A cloud computing platform and infrastructure for building, deploying and managing applications and services through a worldwide network of Microsoft-managed datacenters.
1,029 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,999 questions
Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
2,966 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sina Salam 14,161 Reputation points
    2024-12-22T00:39:08.0866667+00:00

    Hello dotnet_guy,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    I understand that you would like to know the best ways to authenticate from SPFx app (deployed to Teams) to Azure function.

    The best way to reduce overhead are:

    1. For SPFx apps, App Registrations with OAuth2 remain the most straightforward and secure solution - https://learn.microsoft.com/en-us/sharepoint/dev/spfx/use-aadhttpclient and https://www.youtube.com/watch?v=XGD930-O73M
    2. Managed Identities should be considered only in scenarios involving a backend service or API that acts on behalf of the SPFx app. - https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-use-managed-service-identity and https://learn.microsoft.com/en-us/azure/api-management/authentication-managed-identity-policy and https://learn.microsoft.com/en-us/azure/app-service/overview-managed-identity

    Kindly use the resources provided to read more details and step-by-step comprehensive guide to implement secure authentication for SPFx apps and APIs using App Registrations or Managed Identities.

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.


    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.