You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To sign in to Azure from the CLI, run the following command and follow the prompts to complete the authentication process.
51
+
To sign in to Azure from the CLI, run the following command and follow the prompts to complete the authentication process. If you are using Cloud Shell it is not necessary to sign in.
50
52
51
53
```azurecli
52
54
az login
@@ -64,6 +66,10 @@ Next, install or update the Azure Web PubSub extension for the CLI if it wasn't
64
66
az extension add --name webpubsub --upgrade
65
67
```
66
68
69
+
70
+
## 1. Create a resource group
71
+
72
+
67
73
Set the following environment variables. Replace the \<placeholder\> with a unique Web PubSub name.
68
74
69
75
# [Bash](#tab/bash)
@@ -74,6 +80,7 @@ LOCATION="EastUS"
74
80
WEB_PUBSUB_NAME="<your-unique-name>"
75
81
```
76
82
83
+
```azurecli
77
84
# [Azure PowerShell](#tab/azure-powershell)
78
85
79
86
```azurepowershell
@@ -136,13 +143,13 @@ Save the service's connection string. The connection string is used by the serv
136
143
# [Bash](#tab/bash)
137
144
138
145
```azurecli
139
-
connection_string=$(az webpubsub key show --name $WEB_PUBSUB_NAME --resource-group $RESOURCE_GROUP --query primaryConnectionString)
146
+
az webpubsub key show --name $WEB_PUBSUB_NAME --resource-group $RESOURCE_GROUP --query primaryConnectionString
140
147
```
141
148
142
149
# [Azure PowerShell](#tab/azure-powershell)
143
150
144
151
```azurepowershell
145
-
$connection_string = (az webpubsub key show --name $WebPubSubName --resource-group $ResourceGroupName --query primaryConnectionString)
152
+
az webpubsub key show --name $WebPubSubName --resource-group $ResourceGroupName --query primaryConnectionString
146
153
```
147
154
148
155
---
@@ -183,12 +190,29 @@ The connection to the Web PubSub service is established when you see a JSON mess
183
190
184
191
## 4. Publish messages using service SDK
185
192
186
-
You'll use the Azure Web PubSub SDK to publish a message to all the clients connected to the hub.
193
+
You'll use the Azure Web PubSub SDK to publish a message to all the clients connected to the hub.
194
+
You can choose between C#, JavaScript, Python and Java. The dependencies for each language are installed in the steps for that language. Note that Python, JavaScript and Java require a bash shell to run the commands in this quickstart.
187
195
188
196
### Set up the project to publish messages
189
197
190
-
ou will need to open a new command shell for this project.
191
-
Now, select the language for your project. Note that the dependencies for each language are installed in the steps for that language.
198
+
1. Open a new command shell for this project.
199
+
1. Save the connection string from the client shell:
200
+
201
+
# [Bash](#tab/bash)
202
+
203
+
```azurecli
204
+
Connection_String="<your_connection_string>"
205
+
```
206
+
207
+
# [Azure PowerShell](#tab/azure-powershell)
208
+
209
+
```azurepowershell
210
+
$connection_string = "<your_connection_string>"
211
+
```
212
+
213
+
---
214
+
215
+
1. Now, select the language for your project.
192
216
193
217
# [C#](#tab/csharp)
194
218
@@ -419,10 +443,14 @@ Now, select the language for your project. Note that the dependencies for each
419
443
420
444
You can delete the resources that you created in this quickstart by deleting the resource group that contains them.
0 commit comments