Scripts Documentation¶
Quick start scripts for the Microsoft Fabric Casino/Gaming POC. All scripts are provided in both PowerShell (Windows) and Bash (Linux/macOS) versions.
Quick Start¶
# Windows (PowerShell)
.\scripts\setup.ps1 # Set up environment
.\scripts\generate-data.ps1 --quick # Generate demo data
.\scripts\validate-environment.ps1 # Validate setup
# Linux/macOS (Bash)
./scripts/setup.sh # Set up environment
./scripts/generate-data.sh --quick # Generate demo data
./scripts/validate-environment.sh # Validate setup
Scripts Overview¶
| Script | Purpose |
|---|---|
setup.ps1 / setup.sh | Complete environment setup |
generate-data.ps1 / generate-data.sh | Generate synthetic casino data |
deploy-infrastructure.ps1 / deploy-infrastructure.sh | Deploy Azure infrastructure |
validate-environment.ps1 / validate-environment.sh | Validate environment setup |
cleanup.ps1 / cleanup.sh | Cleanup resources and data |
setup.ps1 / setup.sh¶
Purpose: Complete environment setup for the POC.
What It Does¶
- Checks prerequisites (Python 3.10+, Azure CLI, Bicep, Git)
- Creates Python virtual environment (
.venv) - Installs dependencies from
requirements.txt - Validates Azure CLI login
- Creates
.envfrom.env.sample(if needed) - Displays next steps
Usage¶
# Windows
.\scripts\setup.ps1
.\scripts\setup.ps1 -SkipAzureLogin
.\scripts\setup.ps1 -VenvPath "C:\envs\fabric-poc"
# Linux/macOS
./scripts/setup.sh
./scripts/setup.sh --skip-azure-login
./scripts/setup.sh --venv-path /path/to/venv
Parameters¶
| Parameter | Description | Default |
|---|---|---|
-SkipAzureLogin / --skip-azure-login | Skip Azure CLI login validation | false |
-VenvPath / --venv-path | Custom virtual environment path | .venv |
Prerequisites¶
- Python 3.10 or later
- Git
- Azure CLI (for deployment)
- Bicep CLI (installed automatically via Azure CLI)
generate-data.ps1 / generate-data.sh¶
Purpose: Generate synthetic casino/gaming data for the POC.
What It Does¶
- Generates data across all casino domains
- Supports multiple output formats (Parquet, JSON, CSV)
- Configurable data volumes
- Provides progress and summary statistics
Usage¶
# Windows - Quick demo mode
.\scripts\generate-data.ps1 --quick
# Full generation
.\scripts\generate-data.ps1 --all --days 30
# Specific data types
.\scripts\generate-data.ps1 -Slots -SlotCount 100000 -Players -PlayerCount 5000
# Custom output
.\scripts\generate-data.ps1 --all -OutputDir "D:\data" -Format json
# Linux/macOS - Quick demo mode
./scripts/generate-data.sh --quick
# Full generation
./scripts/generate-data.sh --all --days 30
# Specific data types
./scripts/generate-data.sh --slots --slot-count 100000 --players --player-count 5000
# Custom output
./scripts/generate-data.sh --all --output-dir /data/output --format json
Parameters¶
| Parameter | Description | Default |
|---|---|---|
--quick | Quick demo mode (smaller volumes) | false |
--all | Generate all data types | false |
--days | Days of historical data | 30 |
--slot-count | Slot machine events | 500,000 |
--table-count | Table game events | 100,000 |
--player-count | Player profiles | 10,000 |
--financial-count | Financial transactions | 50,000 |
--security-count | Security events | 25,000 |
--compliance-count | Compliance filings | 10,000 |
--output-dir | Output directory | ./data/generated |
--format | Output format: parquet, json, csv | parquet |
--seed | Random seed for reproducibility | 42 |
--include-pii | Include unhashed PII (testing only) | false |
Data Type Flags¶
| Flag | Data Type |
|---|---|
--slots | Slot machine telemetry |
--tables | Table game events |
--players | Player profiles |
--financial | Financial transactions |
--security | Security events |
--compliance | Compliance filings |
Quick Mode Volumes¶
When using --quick, the following reduced volumes are used:
| Data Type | Quick Mode | Full Mode |
|---|---|---|
| Days | 7 | 30 |
| Slot Events | 10,000 | 500,000 |
| Table Events | 5,000 | 100,000 |
| Players | 1,000 | 10,000 |
| Financial | 2,000 | 50,000 |
| Security | 500 | 25,000 |
| Compliance | 200 | 10,000 |
deploy-infrastructure.ps1 / deploy-infrastructure.sh¶
Purpose: Deploy Azure infrastructure using Bicep templates.
What It Does¶
- Loads configuration from
.envfile - Validates required variables
- Creates Azure resource group
- Deploys Bicep templates
- Saves deployment outputs to
deployment-outputs.json
Usage¶
# Windows
.\scripts\deploy-infrastructure.ps1
.\scripts\deploy-infrastructure.ps1 -Environment staging
.\scripts\deploy-infrastructure.ps1 -WhatIf
.\scripts\deploy-infrastructure.ps1 -NoPrompt
# Linux/macOS
./scripts/deploy-infrastructure.sh
./scripts/deploy-infrastructure.sh --environment staging
./scripts/deploy-infrastructure.sh --what-if
./scripts/deploy-infrastructure.sh --no-prompt
Parameters¶
| Parameter | Description | Default |
|---|---|---|
-Environment / --environment | Target: dev, staging, prod | dev |
-Location / --location | Azure region | From .env or eastus2 |
-WhatIf / --what-if | Preview without deploying | false |
-NoPrompt / --no-prompt | Skip confirmation prompts | false |
-ParameterFile / --parameter-file | Custom Bicep parameter file | Auto-detected |
Required .env Variables¶
AZURE_SUBSCRIPTION_ID=<your-subscription-id>
PROJECT_PREFIX=fabricpoc
FABRIC_ADMIN_EMAIL=admin@domain.com
Optional .env Variables¶
Deployment Outputs¶
After deployment, deployment-outputs.json contains:
{
"deploymentName": "fabric-poc-dev-20250121-123456",
"resourceGroup": "fabricpoc-dev-rg",
"environment": "dev",
"location": "eastus2",
"timestamp": "2025-01-21T12:34:56Z",
"outputs": {
"storageAccountName": "fabricpocdevstorage",
"fabricCapacityId": "/subscriptions/.../fabricCapacities/...",
"logAnalyticsWorkspaceId": "..."
}
}
validate-environment.ps1 / validate-environment.sh¶
Purpose: Comprehensive validation of environment setup.
What It Does¶
- Checks all prerequisites
- Validates configuration files
- Tests Azure connectivity
- Verifies Python dependencies
- Tests generator imports
- Runs smoke test (data generation)
- Reports status with visual indicators
Usage¶
Parameters¶
| Parameter | Description | Default |
|---|---|---|
-Quick / --quick | Skip smoke tests | false |
Checks Performed¶
Prerequisites: - Python 3.10+ - Virtual environment - Git - Azure CLI - Bicep
Configuration: - .env file exists and configured - requirements.txt exists - Bicep templates exist - Data generator exists
Azure: - Azure CLI login status - Subscription access
Python: - Required packages importable - Generator classes importable - Data generation smoke test
Exit Codes¶
| Code | Status |
|---|---|
0 | All checks passed (or passed with warnings) |
1 | Validation failed |
cleanup.ps1 / cleanup.sh¶
Purpose: Cleanup and teardown POC resources.
What It Does¶
- Deletes Azure resource group (with confirmation)
- Cleans local generated data
- Removes Python virtual environment
- Cleans cache directories
Usage¶
# Windows
.\scripts\cleanup.ps1 -DeleteData
.\scripts\cleanup.ps1 -DeleteAzure
.\scripts\cleanup.ps1 -DeleteVenv
.\scripts\cleanup.ps1 -All
.\scripts\cleanup.ps1 -All -Force
.\scripts\cleanup.ps1 -DeleteAzure -Environment staging
# Linux/macOS
./scripts/cleanup.sh --delete-data
./scripts/cleanup.sh --delete-azure
./scripts/cleanup.sh --delete-venv
./scripts/cleanup.sh --all
./scripts/cleanup.sh --all --force
./scripts/cleanup.sh --delete-azure --environment staging
Parameters¶
| Parameter | Description | Default |
|---|---|---|
-DeleteData / --delete-data | Delete generated data | false |
-DeleteAzure / --delete-azure | Delete Azure resource group | false |
-DeleteVenv / --delete-venv | Delete virtual environment | false |
-All / --all | Delete everything | false |
-Force / --force | Skip confirmation prompts | false |
-Environment / --environment | Target environment for Azure | dev |
Safety Features¶
- Confirmation prompts: All destructive actions require confirmation
- Azure deletion: Requires typing the resource group name
- Force mode: Bypasses all prompts (use with caution)
- Selective cleanup: Delete only what you need
Typical Workflows¶
Initial Setup¶
# 1. Setup environment
.\scripts\setup.ps1
# 2. Validate setup
.\scripts\validate-environment.ps1
# 3. Generate test data
.\scripts\generate-data.ps1 --quick
Full POC Deployment¶
# 1. Setup environment
.\scripts\setup.ps1
# 2. Configure .env file
code .env
# 3. Generate full dataset
.\scripts\generate-data.ps1 --all --days 30
# 4. Deploy infrastructure
.\scripts\deploy-infrastructure.ps1
# 5. Validate everything
.\scripts\validate-environment.ps1
Cleanup After POC¶
# Delete everything
.\scripts\cleanup.ps1 -All
# Or selectively
.\scripts\cleanup.ps1 -DeleteData
.\scripts\cleanup.ps1 -DeleteAzure
Re-deploy to Different Environment¶
# Deploy to staging
.\scripts\deploy-infrastructure.ps1 -Environment staging
# Later, cleanup staging
.\scripts\cleanup.ps1 -DeleteAzure -Environment staging
Troubleshooting¶
"Python not found"¶
- Install Python 3.10+ from https://www.python.org/downloads/
- Ensure Python is in your PATH
- Run
setup.ps1/setup.shto create virtual environment
"Azure CLI not logged in"¶
"Bicep not installed"¶
"Module import failed"¶
- Ensure virtual environment is activated
- Run
pip install -r requirements.txt - Check for conflicting package versions
"Deployment failed"¶
- Check
.envconfiguration - Verify Azure subscription access
- Run with
--what-ifto preview changes - Check Azure Portal for detailed error messages
"Permission denied" (Linux/macOS)¶
Environment Variables Reference¶
The scripts use these environment variables from .env:
| Variable | Required | Description |
|---|---|---|
AZURE_SUBSCRIPTION_ID | Yes | Azure subscription ID |
PROJECT_PREFIX | Yes | Prefix for resource names |
FABRIC_ADMIN_EMAIL | Yes | Admin email for notifications |
AZURE_TENANT_ID | No | Azure tenant ID |
AZURE_LOCATION | No | Azure region (default: eastus2) |
FABRIC_CAPACITY_SKU | No | Fabric capacity SKU (default: F64) |
ENABLE_PRIVATE_ENDPOINTS | No | Enable private endpoints |
LOG_RETENTION_DAYS | No | Log retention period |
DATA_GENERATION_DAYS | No | Default data generation days |
SLOT_MACHINE_COUNT | No | Number of slot machines |
PLAYER_COUNT | No | Number of players |
Cross-Platform Considerations¶
Line Endings¶
If you encounter issues running bash scripts on Windows or vice versa:
# Convert to Unix line endings
dos2unix scripts/*.sh
# Convert to Windows line endings
unix2dos scripts/*.ps1
Execution Policy (Windows)¶
If PowerShell scripts are blocked:
Permissions (Linux/macOS)¶
Make scripts executable:
Contributing¶
When modifying scripts:
- Update both
.ps1and.shversions - Test on all target platforms
- Update this README with any new parameters
- Follow existing code style and patterns