# Miracles in Motion - Production Deployment Script param( [string]$ResourceGroupName = "rg-miraclesinmotion-prod", [string]$Location = "East US 2", [string]$SubscriptionId = "6187c4d0-3c1a-4135-a8b5-c9782fcf0743" ) Write-Host "🚀 Starting Miracles in Motion Production Deployment" -ForegroundColor Green # Set subscription Write-Host "Setting Azure subscription..." -ForegroundColor Yellow az account set --subscription $SubscriptionId # Create resource group Write-Host "Creating resource group: $ResourceGroupName" -ForegroundColor Yellow az group create --name $ResourceGroupName --location $Location # Deploy infrastructure using Bicep Write-Host "Deploying Azure infrastructure..." -ForegroundColor Yellow $deploymentResult = az deployment group create ` --resource-group $ResourceGroupName ` --template-file infrastructure/main.bicep ` --parameters @infrastructure/main.parameters.json ` --query 'properties.outputs' ` --output json if ($LASTEXITCODE -ne 0) { Write-Error "Infrastructure deployment failed!" exit 1 } Write-Host "✅ Infrastructure deployed successfully!" -ForegroundColor Green # Parse deployment outputs $outputs = $deploymentResult | ConvertFrom-Json # Build and deploy Functions Write-Host "Building Azure Functions..." -ForegroundColor Yellow Set-Location api npm install npm run build # Deploy Functions Write-Host "Deploying Azure Functions..." -ForegroundColor Yellow func azure functionapp publish $outputs.functionAppName.value # Build frontend Write-Host "Building frontend application..." -ForegroundColor Yellow Set-Location .. npm install npm run build # Deploy to Static Web Apps Write-Host "Deploying to Azure Static Web Apps..." -ForegroundColor Yellow az staticwebapp deploy ` --name $outputs.staticWebAppName.value ` --resource-group $ResourceGroupName ` --source dist/ Write-Host "🎉 Deployment completed successfully!" -ForegroundColor Green Write-Host "🌐 Frontend URL: https://$($outputs.staticWebAppName.value).azurestaticapps.net" -ForegroundColor Cyan Write-Host "⚡ Functions URL: https://$($outputs.functionAppName.value).azurewebsites.net" -ForegroundColor Cyan