RockPaperScissorsLizardSpock
Rock, Paper, Scissors, Lizard, Spock - Sample Application
Install / Use
/learn @microsoft/RockPaperScissorsLizardSpockREADME
page_type: sample name: "Rock, Paper, Scissors, Lizard, Spock" urlFragment: azure-rock-paper-scissors description: "Rock, Paper, Scissors, Lizard, Spock is the geek version of the classic Rock, Paper, Scissors game." languages:
- csharp
- powershell
- html
- php
- python
- javascript
- java products:
- azure-cosmos-db
- azure-kubernetes-service
- dotnet-core
- azure-cognitive-services
- vs
- vs-code
Rock, Paper, Scissors, Lizard, Spock - Sample Application
We are happy to announce the release of Rock, Paper, Scissors, Lizard, Spock sample application running in Azure presented at Microsoft Ignite 2019 by Scott Hanselman and friends.

Rock, Paper, Scissors, Lizard, Spock is the geek version of the classic Rock, Paper, Scissors game. Rock, Paper, Scissors, Lizard, Spock is created by Sam Kass and Karen Bryla.
The Rock, Paper, Scissors, Lizard, Spock - Sample Application shows a multilanguage application built with Visual Studio and Visual Studio Code, deployed with GitHub Actions and running on Azure Kubernetes Service (AKS). The sample application also uses Machine Learning and Azure Cognitive Services (Custom Vision API). Languages used in this application include .NET, Node.js, Python, Java, and PHP.
- Missed the keynote session? Watch it here.

- Get everything that you need to deploy the code and run in your subscription.
Table of contents
- Application Screens
- Application Diagram
- Getting Started
- Deployment scenarios
- Swag
- Feedback
- Contributing
<a name="screens"></a>Application Screens

<a name="diagram"></a>Application Diagram

This a multilanguage application running on AKS with AI embedded. There are 5 bots (.NET, NodeJS, Python, Java and PHP) the user can select a language as the opponent and both, the user and the bot will have to select an object to play. The Game Manager which is a .NET API decides who wins based on the logic of the game. If the user is authenticated using Twitter the bots will call a predictor AI Model (Python Azure Function), this model learns from the selections of the objects that the user have done based on the history (stored in a Cosmos DB) to try to predict their next move. If the user is not authenticated the bots will select a random object. There is also a TensorFlow model created with Custom Vision to allow the user to play with their hands by using the webcam.
<a name="getting-started"></a>Getting Started
Pre-Requisites
- You will need Visual Studio 2019 on Windows 10.
- You will need Docker Desktop.
If you want to deploy this solution in Azure:
- You will need and Azure Subscription in order to deploy this.
- Azure CLI.
- Download and install helm.
New to Microsoft Azure?
You will need an Azure subscription to work with this demo code. You can:
- Open an account for free Azure subscription. You get credits that can be used to try out paid Azure services. Even after the credits are used up, you can keep the account and use free Azure services and features, such as the Web Apps feature in Azure App Service.
- Activate Visual Studio subscriber benefits. Your Visual Studio subscription gives you credits every month that you can use for paid Azure services.
- Create an Azure Student Account and get free credit when you create your account.
Learn more about it with Microsoft Learn - Introduction to Azure.
<a name="deployment-scenarios"></a>Deploy to Azure
You can either go through all steps and customizing its configuration or run one single command.
<a name="deploy-unified"></a>Deploy RPSLS using one script
Execute the script located in Deploy folder with the following parameters:
.\Deploy-Unified.ps1 -resourceGroup <resource-group-name> -location <location> -clientId <service-principal-id> -password <service-principal-password> -subscription <subscription-id>
resourceGroup: The name of your resource group where all infrastructure will be createdRequiredlocation: Select where you want to create your resource group, for example:eastusRequiredclientId: Id of the service principal used to create the AKSOptionalpassword: Password of the service principalOptionalsubscription: Id of your subscription where you are going to deploy your resource groupRequired
If service principal credentials are not passed a new one will be created.
<a name="deploy-resources"></a>Deploy RPSLS step by step
To run RPSLS you need to create the Azure infrastructure. There are two ways to do it. Using Azure portal or using a Powershell script.
<a name="create-infrastructure-portal"></a>Step 1 - Option 1: Creating infrastructure using Azure Portal
An ARM template is provided so you can create the whole infrastructure required for RPSLS
servicePrincipalId: Id of the service principal used to create the AKSRequiredservicePrincipalSecret: Password of the service principalRequiredaksVersion: AKS version to use.Required
The deployment could take more than 10 minutes, and once finished all needed resources will be created.
<a name="create-infrastructure-cli"></a>Step 1 - Option 2: Create the resources using the CLI
You can use the CLI to deploy the ARM script. Open a Powershell window from the /Deploy folder and run the Deploy-Arm-Azure.ps1 with following parameters:
-resourceGroup: Name of the resource groupRequired-location: Location of the resource groupRequired if resourceGroup does not exist-clientId: Id of the service principal used to create the AKSOptional-password: Password of the service principalOptional
If service principal credentials are not passed a new one will be created.
Once script finishes, everything is installed. If a service principal has been created, the script will output the service principal details - please, take note of the appId and password properties for use them in the AKS deployment
<a name="deploy-aks"></a>Step 2: Deploy RPSLS on AKS
Pre-requisites for this deployment are to have:
- The AKS and all related resources deployed in Azure
- A terminal with Powershell environment
- Azure CLI 2.0 installed.
- Azure Functions Core Tools installed (required only to deploy Predictor).
- Kubectl installed with the last version (v1.16.0 at this moment).
- Helm 3 installed with 3.0 or superior version (v3.0.0 at this moment).
- Docker installed
Service Principal
A Service Principal is needed for creating the AKS. If you use the CLI for create the resources. You need the client id and password of a Service Principal to install RPSLS.
In case you use Azure Portal for the resources' creation, you can also reuse a SP or create manually a new one for passing the credentials to the template.
Connecting kubectl to AKS
From the terminal type:
az loginand follow instructions to log into your Azure.- If you have more than one subscription type
az account list -o tableto list all your Azure subscriptions. Then typeaz account set --subscription <subscription-id>to select your subscription az aks get-credentials -n <your-aks-name> -g <resource-group-name>to download the configuration files thatkubectlneeds to connect to your AKS.
At this point if you type kubectl config current-context the name of your AKS cluster should be displayed. That means that kubectl is ready to use your AKS
Installing FlexVolume
The KeyVault support is implemented through FlexVol. To install Flex Volume in the AKS, type the following:
.\Create-Kv-FlexVolume.ps1
Publish Python Azure Function
To publish the Azure Function you can execute the next command of the Azure Functions Core Tools from the folder /Source/Functions/RPSLS.Python.Api:
func azure functionapp publish <funcapp-name> --no-build
The value for funcapp-name must be the name of the Function App created in your Azure Resource Group.
Configuring services
Before deploying services using Helm, you need to setup the configuration. We refer to the configuration file with the name of gvalues file. This file contains all secrets so beware to not commit in your repo accidentally.
A template of this f


