I created an Azure Function App by Bicep and tried to get the signalr_extension
‘s value to use in the "upstream" configuration section of a serverless Azure SignalR Service. This is how I try to obtain this value in Bicep:
var signalRKey = listKeys(resourceId('Microsoft.Web/sites/host', funcAppName, 'default'), '2022-03-01').systemkeys.signalr_extension
This is how I configure the signalR service’s upstream:
urlTemplate: 'https://${funcAppName}.azurewebsites.net/runtime/webhooks/signalr?code=${signalRKey}'
Running the bicep templates leads to the failure below:
Encountered an error (ServiceUnavailable) from host runtime.
When I remove the {signalRKey}
from urlTemplate
and replace it with a fictitious hard-coded value, the signalR is provisioned successfully.
The other thing that I noticed was that the singalr_extension
key value was not populated after the function app was provisioned.
What am I missing in this exercise?
2
Answers
This feature is not available and feasible in App Service Plans. The
signalr_extension
must be populated manually after deploying the function app and signalR.The
signalr_extension
is only created once you’ve deployed your function app with aSignalRTrigger
function.You can generate this key upfront if you’re deploying the Function App and signalR service at the same time:
The ARM API to generate function keys is just pointing to the function app API so it could take some time before it become available (see issue on github).
I managed to get this working consistently by deploying the systemkey and signalr using module.
Also for function app running on
linux
, theAzureWebJobsStorage
setting is mandatory.functionapp-systemkey.bicep module:
signalr.bicep module:
main.bicep: