Skip to content

Commit 4d61b66

Browse files
authored
Update sample for bidirection chatroom (#147)
* Update sample for bidirection chatroom * Change back extensions as signalrtrigger is not in the bundle
1 parent 0408d0e commit 4d61b66

File tree

3 files changed

+44
-39
lines changed

3 files changed

+44
-39
lines changed

samples/BidirectionChat/README.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ It's a quick try of this sample. You will create an Azure SignalR Service and an
2727
1. Create Azure SignalR Service using `az cli`
2828

2929
```bash
30-
az signalr create -n <signalr-name> -g <resource-group-name> --service-mode Serverless --sku Free_F1
30+
resourceGroup=myResourceGroup
31+
signalrName=mySignalRName
32+
33+
az signalr create -n $signalrName -g $resourceGroup --service-mode Serverless --sku Standard_S1
34+
# Get connection string for later use.
35+
connectionString=$(az signalr key list -n $signalrName -g $resourceGroup --query primaryConnectionString -o tsv)
3136
```
3237

3338
For more details about creating Azure SignalR Service, see the [tutorial](https://docs.microsoft.com/en-us/azure/azure-signalr/signalr-quickstart-azure-functions-javascript#create-an-azure-signalr-service-instance).
@@ -42,41 +47,41 @@ It's a quick try of this sample. You will create an Azure SignalR Service and an
4247
#!/bin/bash
4348
4449
# Function app and storage account names must be unique.
45-
storageName=mystorageaccount$RANDOM
46-
functionAppName=myserverlessfunc$RANDOM
47-
region=westeurope
48-
50+
storageName=mystorageaccount
51+
functionAppName=myserverlessfunc
52+
region=eastus
53+
4954
# Create a resource group.
50-
az group create --name myResourceGroup --location $region
55+
az group create --name $resourceGroup --location $region
5156
5257
# Create an Azure storage account in the resource group.
5358
az storage account create \
5459
--name $storageName \
5560
--location $region \
56-
--resource-group myResourceGroup \
61+
--resource-group $resourceGroup \
5762
--sku Standard_LRS
5863
5964
# Create a serverless function app in the resource group.
6065
az functionapp create \
6166
--name $functionAppName \
6267
--storage-account $storageName \
6368
--consumption-plan-location $region \
64-
--resource-group myResourceGroup \
69+
--resource-group $resourceGroup \
6570
--functions-version 3
6671
```
6772

6873
3. Publish the sample to the Azure Function you created before.
6974

7075
```bash
71-
cd <root>/bidirectional-chat/csharp
76+
cd <root>/samples/BidirectionChat/csharp
7277
// If prompted function app version, use --force
73-
func azure functionapp publish <function-app-name>
78+
func azure functionapp publish $functionAppName
7479
```
7580

7681
2. Update application settings
7782

7883
```bash
79-
az functionapp config appsettings set --resource-group <resource_group_name> --name <function_name> --setting AzureSignalRConnectionString="<signalr_connection_string>"
84+
az functionapp config appsettings set --resource-group $resourceGroup --name $functionAppName --setting AzureSignalRConnectionString=$connectionString
8085
```
8186

8287
3. Update Azure SignalR Service Upstream settings
Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
2-
<PropertyGroup>
3-
<TargetFramework>netcoreapp3.1</TargetFramework>
4-
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
5-
<RootNamespace>bidirectional_chat</RootNamespace>
6-
</PropertyGroup>
7-
<ItemGroup>
8-
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.3" />
9-
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.SignalRService" Version="1.2.0" />
10-
</ItemGroup>
11-
<ItemGroup>
12-
<None Update="content/index.html">
13-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
14-
</None>
15-
<None Update="host.json">
16-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
17-
</None>
18-
<None Update="local.settings.sample.json">
19-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
20-
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
21-
</None>
22-
<None Update="local.settings.json">
23-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
24-
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
25-
</None>
26-
</ItemGroup>
27-
</Project>
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>netcoreapp3.1</TargetFramework>
4+
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
5+
<RootNamespace>bidirectional_chat</RootNamespace>
6+
</PropertyGroup>
7+
<ItemGroup>
8+
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.3" />
9+
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.SignalRService" Version="1.2.0" />
10+
</ItemGroup>
11+
<ItemGroup>
12+
<None Update="content/index.html">
13+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
14+
</None>
15+
<None Update="host.json">
16+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
17+
</None>
18+
<None Update="local.settings.sample.json">
19+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
20+
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
21+
</None>
22+
<None Update="local.settings.json">
23+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
24+
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
25+
</None>
26+
</ItemGroup>
27+
</Project>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
22
"version": "2.0"
3-
}
3+
}

0 commit comments

Comments
 (0)