Quickstart: Use Bicep to deploy Azure SignalR Service

This quickstart describes how to use Bicep to create an Azure SignalR Service using Azure CLI or PowerShell.

Bicep is a domain-specific language (DSL) that uses declarative syntax to deploy Azure resources. It provides concise syntax, reliable type safety, and support for code reuse. Bicep offers the best authoring experience for your infrastructure-as-code solutions in Azure.


An Azure account with an active subscription. Create one for free.

Review the Bicep file

The Bicep file used in this quickstart is from Azure Quickstart Templates.

@description('The globally unique name of the SignalR resource to create.')
param name string = uniqueString(resourceGroup().id)

@description('Location for the SignalR resource.')
param location string = resourceGroup().location

@description('The pricing tier of the SignalR resource.')
param pricingTier string = 'Standard_S1'

@description('The number of SignalR Unit.')
param capacity int = 1

@description('Visit https://github.com/Azure/azure-signalr/blob/dev/docs/faq.md#service-mode to understand SignalR Service Mode.')
param serviceMode string = 'Default'

param enableConnectivityLogs bool = true

param enableMessagingLogs bool = true

param enableLiveTrace bool = true

@description('Set the list of origins that should be allowed to make cross-origin calls.')
param allowedOrigins array = [

resource signalR 'Microsoft.SignalRService/signalR@2022-02-01' = {
  name: name
  location: location
  sku: {
    capacity: capacity
    name: pricingTier
  kind: 'SignalR'
  identity: {
    type: 'SystemAssigned'
  properties: {
    tls: {
      clientCertEnabled: false
    features: [
        flag: 'ServiceMode'
        value: serviceMode
        flag: 'EnableConnectivityLogs'
        value: string(enableConnectivityLogs)
        flag: 'EnableMessagingLogs'
        value: string(enableMessagingLogs)
        flag: 'EnableLiveTrace'
        value: string(enableLiveTrace)
    cors: {
      allowedOrigins: allowedOrigins
    networkACLs: {
      defaultAction: 'Deny'
      publicNetwork: {
        allow: [
      privateEndpoints: [
          name: 'mySignalRService.1fa229cd-bf3f-47f0-8c49-afb36723997e'
          allow: [
    upstream: {
      templates: [
          categoryPattern: '*'
          eventPattern: 'connect,disconnect'
          hubPattern: '*'
          urlTemplate: 'https://example.com/chat/api/connect'

The Bicep file defines one Azure resource:

Deploy the Bicep file

  1. Save the Bicep file as main.bicep to your local computer.

  2. Deploy the Bicep file using either Azure CLI or Azure PowerShell.

    az group create --name exampleRG --location eastus
    az deployment group create --resource-group exampleRG --template-file main.bicep

    When the deployment finishes, you should see a message indicating the deployment succeeded.

Review deployed resources

Use the Azure portal, Azure CLI, or Azure PowerShell to list the deployed resources in the resource group.

az resource list --resource-group exampleRG

Clean up resources

When no longer needed, use the Azure portal, Azure CLI, or Azure PowerShell to delete the resource group and its resources.

az group delete --name exampleRG

Next steps

For a step-by-step tutorial that guides you through the process of creating a Bicep file using Visual Studio Code, see: