This project is intended to demonstrate some basic concepts around personal account security and password hygiene.
You can run and debug the entire solution locally using Azure Functions tools and the Azure Storage emulator.
- Install the Azure Storage Emulator.
- Install the Azure Functions Core Tools.
- Install NodeJS LTS.
- Install Visual Studio Code.
To actually run the chat locally, you'll need an Azure SignalR instance. Create an Azure SignalR dev/test instance with the Serverless service mode and take note of the connection string.
- Copy the contents of
backend-api/example.settings.json
tobackend-api/local.settings.json
. - Replace the value
YOUR_SIGNALR_CONNECTION_STRING
with your connection string from the previous section.
Run the following to build:
pushd ./shared
npm install
npm run build
popd
- Start the Azure Storage Emulator by launching it from the start menu. An icon will appear in the taskbar.
- In VS Code, start the
backend-api
by choosingDebug backend-api
from the Run and Debug tab and pressing the green arrow button. - In VS Code, start the
cat-game
app by choosingDebug cat-game
from the Run and Debug tab and pressing the green arrow button. - In VS Code, start the
dog-game
app by choosingDebug dog-game
from the Run and Debug tab and pressing the green arrow button.
The solution will be automatically deployed using GitHub actions when a push or completed pull request to the main
branch occurs.
To setup the GitHub Actions project deployment workflow for automated deployment to Azure, do the following:
(These commands use the Azure CLI.)
- Create a service principal for Terraform deployment:
Note the service principal's appId, name, password, and tenant for use in the following steps.
# Create Service Principal
az ad sp create-for-rbac --name http://YOUR_SERVICE_PRINCIPAL_NAME
- Create a storage account where Terraform state will be saved:
Note the storage account name for use in step 4.
# Create Resource Group
az group create -n YOUR_RESOURCE_GROUP_NAME -l westus2
# Create Storage Account
az storage account create -n YOUR_STORAGE_ACCOUNT_NAME -g YOUR_RESOURCE_GROUP_NAME --sku Standard_LRS
# Create Storage Account Container
az storage container create -n tfstate --account-name YOUR_STORAGE_ACCOUNT_NAME
# Assign the Serivce Principal access
az role assignment create --assignee http://YOUR_SERVICE_PRINCIPAL_NAME --role Contributor -g YOUR_RESOURCE_GROUP_NAME
- Create a resource group where the solution will be deployed:
Use a different resource group name than step 2 otherwise the Terraform deployment will break.
Note the resource group name for use in step 4.
# Create Resource Group
az group create -n YOUR_RESOURCE_GROUP_NAME -l westus2
# Assign the Serivce Principal access
az role assignment create --assignee http://YOUR_SERVICE_PRINCIPAL_NAME --role Contributor -g YOUR_RESOURCE_GROUP_NAME
- Add the following secrets to your GitHub repository (GitHub docs):
ARM_TENANT_ID
: Your Azure AD tenant IDARM_CLIENT_ID
: Your service principal app IDARM_CLIENT_SECRET
: Your service principal passwordARM_SUBSCRIPTION_ID
: Your Azure subscription IDAZURE_TFSTATE_RESOURCE_GROUP
: The resource group name you created in step 2AZURE_TFSTATE_STORAGE_ACCOUNT
: The storage account you created in step 2AZURE_RESOURCE_GROUP
: The resource group name you created in step 3