This folder contains Bash scripts for deploying an Azure Functions application with supporting Azure services using the lstk CLI. The deployment creates a complete gaming scoreboard system using Azure Functions and Azure Storage Account with direct Azure CLI commands through the LocalStack Azure emulator. For more information, see Azure Functions Sample with LocalStack for Azure.
Before deploying this solution, ensure you have the following tools installed:
- LocalStack for Azure: Local Azure cloud emulator for development and testing
- Visual Studio Code: Code editor installed on one of the supported platforms
- .NET SDK: Required for building and publishing the C# Azure Functions application
- Docker: Container runtime required for LocalStack
- Azure CLI: Azure command-line interface
- lstk CLI: LocalStack command-line interface (proxies the Azure CLI via
lstk az) - jq: JSON processor for scripting and parsing command outputs
Deploying to LocalStack requires the lstk CLI, which routes Azure CLI commands to the emulator (run lstk az start-interception before deploying). Install it using Homebrew:
brew install localstack/tap/lstkor npm:
npm install -g @localstack/lstkAlternatively, download a pre-built binary from the lstk releases page. For more information, see the lstk CLI documentation and the lstk GitHub repository.
This deploy.sh script creates the following Azure resources using Azure CLI commands:
- Azure Resource Group: Logical container for all gaming system resources.
- Azure Storage Account: Provides blob containers, queues, and tables for the gaming system.
- Azure Linux Function App Serverless compute platform hosting the gaming logic with consumption plan.
The system implements a complete gaming scoreboard with multiple Azure Functions that handle HTTP requests, process blob uploads, manage queue messages, and maintain game statistics. For more information, see Azure Functions Sample with LocalStack for Azure.
See deploy.sh for the complete deployment script. The script performs:
- Creates resource group if it doesn't exist
- Creates Storage Account and retrieves access key
- Creates Function App with consumption plan
- Constructs storage connection string
- Configures Function App settings (storage, queue, table, timer configurations)
- Builds and publishes the .NET application in Release configuration
- Creates deployment zip package from published output
- Deploys the zip to Azure Function App using
az functionapp deploy
-
You can set up the Azure emulator by utilizing LocalStack for Azure Docker image. Before starting, ensure you have a valid
LOCALSTACK_AUTH_TOKENto access the Azure emulator. Refer to the Auth Token guide to obtain your Auth Token and specify it in theLOCALSTACK_AUTH_TOKENenvironment variable. The Azure Docker image is available on the LocalStack Docker Hub. To pull the Azure Docker image, execute the following command:docker pull localstack/localstack-azure
-
Start the LocalStack Azure emulator using the localstack CLI, execute the following command:
export LOCALSTACK_AUTH_TOKEN=<your_auth_token> IMAGE_NAME=localstack/localstack-azure localstack start
-
Navigate to the scripts directory
cd samples/function-app-storage-http/dotnet/scripts -
Make the script executable:
chmod +x deploy.sh
-
Run the deployment script:
./deploy.sh
You can customize the deployment by modifying the variables at the top of deploy.sh:
# Customizable variables
PREFIX='myapp' # Change resource name prefix
SUFFIX='prod' # Change resource name suffix
LOCATION='eastus' # Change deployment region
RUNTIME="DOTNET-ISOLATED" # Runtime type
RUNTIME_VERSION="10" # Runtime versionThe script configures the following application settings for the gaming system:
| Setting | Purpose | Default Value |
|---|---|---|
AzureWebJobsStorage |
Functions runtime storage | Auto-generated connection string |
STORAGE_ACCOUNT_CONNECTION_STRING |
Application storage access | Auto-generated connection string |
INPUT_STORAGE_CONTAINER_NAME |
Blob input container | input |
OUTPUT_STORAGE_CONTAINER_NAME |
Blob output container | output |
INPUT_QUEUE_NAME |
Message input queue | input |
OUTPUT_QUEUE_NAME |
Message output queue | output |
TRIGGER_QUEUE_NAME |
Queue trigger name | trigger |
INPUT_TABLE_NAME |
Scoreboards table | scoreboards |
OUTPUT_TABLE_NAME |
Winners table | winners |
PLAYER_NAMES |
Game player list | Comma-separated names |
TIMER_SCHEDULE |
Scheduled function trigger | 0 */1 * * * * (every minute) |
FUNCTIONS_WORKER_RUNTIME |
Runtime specification | dotnet-isolated |
-
lstk az start-interception:- Redirects Azure CLI calls to LocalStack endpoints
- Enables local development without Azure subscription
- Maintains compatibility with standard Azure CLI syntax
-
az functionapp deploy:- Deploys the zipped publish output to the function app
- Works identically against LocalStack and Azure
- Uses the standard Azure CLI zip deployment mechanism
-
lstk az stop-interception:- Restores normal Azure CLI behavior
- Cleans up LocalStack session state
- Returns CLI to standard Azure cloud operations
After deployment, you can use the validate.sh script to verify that all resources were created and configured correctly:
#!/bin/bash
# Variables
# Check resource group
az group show \
--name local-rg \
--output table
# List resources
az resource list \
--resource-group local-rg \
--output table
# Check function app status
az functionapp show \
--name local-func-test \
--resource-group local-rg \
--output table
# Check storage account properties
az storage account show \
--name localstoragetest \
--resource-group local-rg \
--output table
# List storage containers
az storage container list \
--account-name localstoragetest \
--output table \
--only-show-errors
# List storage queues
az storage queue list \
--account-name localstoragetest \
--output table \
--only-show-errors
# List storage tables
az storage table list \
--account-name localstoragetest \
--output table \
--only-show-errorsTo destroy all created resources:
# Delete resource group and all contained resources
az group delete --name local-rg --yes --no-wait
# Verify deletion
az group list --output tableThis will remove all Azure resources created by the CLI deployment script.
- Azure CLI Documentation
- Azure Functions CLI Documentation
- Azure Functions Methods Documentation - Detailed documentation of all implemented functions
- LocalStack for Azure Documentation
- lstk CLI
- lstk GitHub repository