Adding Entra ID authentication to a web app that utilizes Web PubSub in Azure

Peter Daniels 40 Reputation points
2024-05-03T07:15:10.3633333+00:00

I'm trying to simply add Microsoft Entra ID for authentication to an Azure web app. I have a javascript chat-app using Web PubSub that worked perfectly using this example:

https://github.com/Azure/azure-webpubsub/tree/main/samples/javascript/chatapp/nativeapi

I followed the instructions here using the work-force configuration...

https://learn.microsoft.com/en-us/azure/app-service/scenario-secure-app-authentication-app-service?tabs=workforce-configuration

The instruction description says "No SDKs, specific languages, or changes to application code are required." I used the defaults and now the app will connect to chat server, but then the connection is terminated with the first message. I make up that Web PubSub needs to be authenticated to my web app, but I'm unsure how to get this done. Is that the problem? How do I resolve in the simplest method, preferably with no code changes?

Thank you,
Peter

Azure Web PubSub
Azure Web PubSub
An Azure service that provides real-time messaging for web applications using WebSockets and the publish-subscribe pattern.
66 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,027 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,843 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Liangying Wei 756 Reputation points Microsoft Employee
    2024-05-08T06:04:02.43+00:00

    Here are the steps showing how to enable managed identity authentication in event handler settings https://learn.microsoft.com/en-us/azure/azure-web-pubsub/howto-use-managed-identity#enable-managed-identity-authentication-in-event-handler-settings