Skip to content

Disable Local Auth on Azure SignalR #9798

Closed
@eerhardt

Description

@eerhardt

We have a goal to disable local auth by default in our Azure integrations and only use managed identity.

AddAzureSignalR should set the SignalRService to have DisableLocalAuth=true by default.

https://learn.microsoft.com/en-us/azure/templates/microsoft.signalrservice/signalr?pivots=deployment-language-bicep#resource-format

(infrastructure) => new SignalRService(infrastructure.AspireResource.GetBicepIdentifier())
{
Kind = SignalRServiceKind.SignalR,
Sku = new SignalRResourceSku()
{
Name = "Free_F1",
Capacity = 1
},
Features =
[
new SignalRFeature()
{
Flag = SignalRFeatureFlag.ServiceMode,
Value = serviceMode.ToString()
}
],
CorsAllowedOrigins = ["*"],
Tags = { { "aspire-resource-name", infrastructure.AspireResource.Name } }
});

I attempted to do this myself, but when testing it with the signalr playground app, the app was unable to make a connection. It kept spitting out this log:

info: Microsoft.Azure.SignalR.Connections.Client.Internal.WebSocketsTransport[1]
      Starting transport. Transfer mode: Binary. Url: 'wss://signalrdefault-l4r7g7ruqcqbg.service.signalr.net/server/?hub=chathub&cid=7d6abec8-d857-49ce-ab97-9f30d6f378a8'.
info: Microsoft.Azure.SignalR.Connections.Client.Internal.WebSocketsTransport[6]
      Transport is stopping.
info: Microsoft.Azure.SignalR.ServiceConnection[2]
      Failed to connect to '(Primary)https://signalrdefault-l4r7g7ruqcqbg.service.signalr.net(hub=ChatHub)', will retry after the back off period. Error detail: The server returned status code '403' when status code '101' was expected.. The server returned status code '403' when status code '101' was expected.. Id: 7d6abec8-d857-49ce-ab97-9f30d6f378a8
warn: Microsoft.Azure.SignalR.StrongServiceConnectionContainer[2]
      Hub 'ChatHub' is now disconnected from '(Primary)https://signalrdefault-l4r7g7ruqcqbg.service.signalr.net(hub=ChatHub)'. Please check log for detailed info.
info: Microsoft.Azure.SignalR.Connections.Client.Internal.WebSocketsTransport[1]
      Starting transport. Transfer mode: Binary. Url: 'wss://signalrdefault-l4r7g7ruqcqbg.service.signalr.net/server/?hub=chathub&cid=3389cceb-fde5-4946-bb39-c42066131455'.
info: Microsoft.Azure.SignalR.Connections.Client.Internal.WebSocketsTransport[1]
      Starting transport. Transfer mode: Binary. Url: 'wss://signalrdefault-l4r7g7ruqcqbg.service.signalr.net/server/?hub=chathub&cid=338d1cc3-9c97-413a-b197-d5c12c6cd708'.
info: Microsoft.Azure.SignalR.Connections.Client.Internal.WebSocketsTransport[1]
      Starting transport. Transfer mode: Binary. Url: 'wss://signalrdefault-l4r7g7ruqcqbg.service.signalr.net/server/?hub=chathub&cid=a5e84e59-69ce-4c98-b6cf-525ce1b3bd60'.
info: Microsoft.Azure.SignalR.Connections.Client.Internal.WebSocketsTransport[1]
      Starting transport. Transfer mode: Binary. Url: 'wss://signalrdefault-l4r7g7ruqcqbg.service.signalr.net/server/?hub=chathub&cid=b33992a8-6b46-49ba-80e5-32f0079f044a'.
info: Microsoft.Azure.SignalR.Connections.Client.Internal.WebSocketsTransport[6]
      Transport is stopping.
info: Microsoft.Azure.SignalR.ServiceConnection[2]
      Failed to connect to '(Primary)https://signalrdefault-l4r7g7ruqcqbg.service.signalr.net(hub=ChatHub)', will retry after the back off period. Error detail: The server returned status code '403' when status code '101' was expected.. The server returned status code '403' when status code '101' was expected.. Id: a5e84e59-69ce-4c98-b6cf-525ce1b3bd60

cc @vicancy

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-integrationsIssues pertaining to Aspire Integrations packagesazureIssues associated specifically with scenarios tied to using Azureazure-signalrIssues related to the Azure SignalR hosting integrationbreaking-changeIssue or PR that represents a breaking API or functional change over a prerelease.security 🔐

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions