Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions samples/BidirectionChat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ It's a quick try of this sample. You will create an Azure SignalR Service and an
1. Create Azure SignalR Service using `az cli`

```bash
az signalr create -n <signalr-name> -g <resource-group-name> --service-mode Serverless --sku Free_F1
resourceGroup=myResourceGroup
signalrName=mySignalRName

az signalr create -n $signalrName -g $resourceGroup --service-mode Serverless --sku Standard_S1
# Get connection string for later use.
connectionString=$(az signalr key list -n $signalrName -g $resourceGroup --query primaryConnectionString -o tsv)
```

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).
Expand All @@ -42,41 +47,41 @@ It's a quick try of this sample. You will create an Azure SignalR Service and an
#!/bin/bash

# Function app and storage account names must be unique.
storageName=mystorageaccount$RANDOM
functionAppName=myserverlessfunc$RANDOM
region=westeurope

storageName=mystorageaccount
functionAppName=myserverlessfunc
region=eastus
# Create a resource group.
az group create --name myResourceGroup --location $region
az group create --name $resourceGroup --location $region

# Create an Azure storage account in the resource group.
az storage account create \
--name $storageName \
--location $region \
--resource-group myResourceGroup \
--resource-group $resourceGroup \
--sku Standard_LRS

# Create a serverless function app in the resource group.
az functionapp create \
--name $functionAppName \
--storage-account $storageName \
--consumption-plan-location $region \
--resource-group myResourceGroup \
--resource-group $resourceGroup \
--functions-version 3
```

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

```bash
cd <root>/bidirectional-chat/csharp
cd <root>/samples/BidirectionChat/csharp
// If prompted function app version, use --force
func azure functionapp publish <function-app-name>
func azure functionapp publish $functionAppName
```

2. Update application settings

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

3. Update Azure SignalR Service Upstream settings
Expand Down
54 changes: 27 additions & 27 deletions samples/BidirectionChat/csharp/extensions.csproj
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
<RootNamespace>bidirectional_chat</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.3" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.SignalRService" Version="1.2.0" />
</ItemGroup>
<ItemGroup>
<None Update="content/index.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.sample.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
<RootNamespace>bidirectional_chat</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.3" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.SignalRService" Version="1.2.0" />
</ItemGroup>
<ItemGroup>
<None Update="content/index.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.sample.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion samples/BidirectionChat/csharp/host.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "2.0"
}
}