This is a sample of a serverless multiplayer game running in Azure using the following technologies:
This recording of the Global Azure 2023 session walks you through the code:
 
You can use the following emulators for local development:
- Azurite (should start automatically when you launch the TicTacToe.Functionsproject)
- Azure SignalR Emulator
dotnet tool install  -g Microsoft.Azure.SignalR.Emulator
cd .\src\TicTacToe.Functions
asrs-emulator startIf you want to deploy the sample to your own Azure subscription:
- 
Start by forking this repository 
- 
Create a resource group in your Azure subscription 
- 
Then you can use the deployment script in the iacfolder to create the necessary resources:az deployment group create --resource-group my-sample --template-file iac/main.bicep --name samples-serverless-tictactoe 
- 
You need to provide your repository URL and a GitHub access token as parameters (the command above will ask for them). You can create an access token here (it requires Read access to metadataandRead and Write access to actions, actions variables, code, secrets, and workflowspermissions for your repository).
- 
Running the command will (among others) create a Function App and a Static Web App in your resource group and create a GitHub action for the Static Web App in your repository. 
- 
Replace the URL in appsettings.json with the URL of your Function App (keep the /apipostfix).
- 
Download the publish profile for the Function App that was created. 
- 
Create a new repository secret named AZURE_FUNCTIONAPP_PUBLISH_PROFILEand paste the XML code from the publish profile as the value.
- 
Then you can copy the code from the existing GitHub action to the new action (but replace AZURE_STATIC_WEB_APPS_API_TOKEN_AMBITIOUS_RIVER_0FBF49203with the secret name from your file).
- 
You can now delete the existing GitHub action. 
- 
Running the GitHub action should now build and deploy the code and you should be able to run the game by accessing your Static Web App. 
- 
Have fun!