title: Is there a way to Authenticate users who connect to Azure SignalR?
body: <p>I am really struggling to understand on how to implement this. I have an Azure SignalR service running. I have an Azure Function setup. I have a Web API.</p>
  <p>The Web API fires a HTTP POST to the Azure Function and using a HTTPTrigger it then sends out (broadcasts) to all users who are connected to the Azure SignalR service. Great!</p>
  <p>Now I have a problem, the Web API must send messages only to a specific user for each HTTP POST. Obviously this would me the user would need to authenticate somehow when they connect to (or &quot;Negotiate&quot;) with Azure SignalR.</p>
  <p>Truth be told, I know how to authenticate users when I have a self-hosted SignalR application. Done this prior with bearer token authentication whenever users connected to the Hub for SignalR. However, that was self-hosted SignalR. I am now using Azure SignalR hosted on Azure.</p>
  <p>Also I need to say that the Negotatiate and all methods that the clients for the Azure SignalR listen to are Azure Functions.</p>
  <pre><code>[FunctionName(&quot;negotiate&quot;)]
      public static SignalRConnectionInfo Negotiate(
      [HttpTrigger(AuthorizationLevel.Anonymous)] HttpRequest req,
      [SignalRConnectionInfo
          (HubName = &quot;notifications&quot;)] //, UserId = &quot;{headers.x-ms-client-principal-id}&quot;
          SignalRConnectionInfo connectionInfo)
      {
          // connectionInfo contains an access key token with a name identifier claim set to the authenticated user
          return connectionInfo;
      }
  
      [FunctionName(&quot;PlacedOrderNotification&quot;)]
      public static async Task Placed(
      [QueueTrigger(&quot;new-order-notifications&quot;)] OrderPlacement orderPlacement,
      [SignalR(HubName = &quot;notifications&quot;)] IAsyncCollector&lt;SignalRMessage&gt; signalRMessages,
      ILogger log)
          {
              log.LogInformation($&quot;Sending notification for {orderPlacement.CustomerName}&quot;);
  
              await signalRMessages.AddAsync(
                  new SignalRMessage
                  {
                      Target = &quot;productOrdered&quot;,
                      Arguments = new[] { orderPlacement }
                  });
          }
  </code></pre>
  <p>I want to take my bearer token authentication and place it within Azure SignalR somehow.</p>
  <p>Now the million dollar question... how on earth do I go about doing that? Can I re-use my Bearer Auth code used for a self hosted SignalR service and integrate it into my architecture somehow?</p>