Skip to content

Commit 3f5d23c

Browse files
authored
Merge pull request #256568 from bjqian/main
Add bicep for signalr replica
2 parents 7b6e6b0 + 92e0cc7 commit 3f5d23c

File tree

1 file changed

+59
-5
lines changed

1 file changed

+59
-5
lines changed

articles/azure-signalr/howto-enable-geo-replication.md

Lines changed: 59 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,72 @@ With the new geo-replication feature, Contoso can now establish a replica in Can
5151
![Diagram of using one Azure SignalR instance with replica to handle traffic from two countries.](./media/howto-enable-geo-replication/signalr-replica.png "Replica Example")
5252

5353
## Create a SignalR replica
54-
54+
# [Portal](#tab/Portal)
5555
To create a replica, Navigate to the SignalR **Replicas** blade on the Azure portal and click **Add** to create a replica. It will be automatically enabled upon creation.
5656

5757
![Screenshot of creating replica for Azure SignalR on Portal.](./media/howto-enable-geo-replication/signalr-replica-create.png "Replica create")
5858

59-
> [!NOTE]
60-
> * Geo-replication is a feature available in premium tier.
61-
> * A replica is considered a separate resource when it comes to billing. See [Pricing and resource unit](#pricing-and-resource-unit) for more details.
62-
6359
After creation, you would be able to view/edit your replica on the portal by clicking the replica name.
6460

6561
![Screenshot of overview blade of Azure SignalR replica resource. ](./media/howto-enable-geo-replication/signalr-replica-overview.png "Replica Overview")
62+
# [Bicep](#tab/Bicep)
63+
64+
Use Visual Studio Code or your favorite editor to create a file with the following content and name it main.bicep:
65+
66+
```bicep
67+
@description('The name for your SignalR service')
68+
param primaryName string = 'contoso'
69+
70+
@description('The region in which to create your SignalR service')
71+
param primaryLocation string = 'eastus'
72+
73+
@description('Unit count of your SignalR service')
74+
param primaryCapacity int = 1
75+
76+
resource primary 'Microsoft.SignalRService/signalr@2023-08-01-preview' = {
77+
name: primaryName
78+
location: primaryLocation
79+
sku: {
80+
capacity: primaryCapacity
81+
name: 'Premium_P1'
82+
}
83+
properties: {
84+
}
85+
}
86+
87+
@description('The name for your SignalR replica')
88+
param replicaName string = 'contoso-westus'
89+
90+
@description('The region in which to create the SignalR replica')
91+
param replicaLocation string = 'westus'
92+
93+
@description('Unit count of the SignalR replica')
94+
param replicaCapacity int = 1
95+
96+
@description('Whether to enable region endpoint for the replica')
97+
param regionEndpointEnabled string = 'Enabled'
98+
99+
resource replica 'Microsoft.SignalRService/signalr/replicas@2023-08-01-preview' = {
100+
parent: primary
101+
name: replicaName
102+
location: replicaLocation
103+
sku: {
104+
capacity: replicaCapacity
105+
name: 'Premium_P1'
106+
}
107+
properties: {
108+
regionEndpointEnabled: regionEndpointEnabled
109+
}
110+
}
111+
```
112+
113+
Deploy the Bicep file using Azure CLI
114+
```azurecli
115+
az group create --name MyResourceGroup --location eastus
116+
az deployment group create --resource-group MyResourceGroup --template-file main.bicep
117+
```
118+
119+
----
66120

67121
## Pricing and resource unit
68122
Each replica has its **own** `unit` and `autoscale settings`.

0 commit comments

Comments
 (0)