Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Prepare applications for Azure deployment by generating infrastructure code, Dockerfiles, and config files.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/services/static-web-apps/deployment.md
1# Static Web Apps - Deployment23## azd Deploy (Default)45Standard deployment via Azure Developer CLI:67```bash8azd deploy9```1011## GitHub-Linked Deployments1213For CI/CD builds on Azure (instead of azd deploy):1415```bicep16properties: {17repositoryUrl: 'https://github.com/owner/repo'18branch: 'main'19buildProperties: {20appLocation: 'src'21apiLocation: 'api'22outputLocation: 'dist'23}24}25```2627## Deployment Token2829> ⚠️ **Security Warning:** Do NOT expose deployment tokens in ARM/Bicep outputs. Deployment outputs are visible in Azure portal deployment history and logs.3031**Recommended approach** - retrieve token via Azure CLI and store directly in secret store:3233```bash34# Capture token to variable (never echo or log)35DEPLOYMENT_TOKEN=$(az staticwebapp secrets list --name <app-name> --query "properties.apiKey" -o tsv)3637# Store directly in Key Vault38az keyvault secret set --vault-name <vault-name> --name swa-deployment-token --value "$DEPLOYMENT_TOKEN" --output none39```4041**Do NOT do this** (exposes token in deployment history):42```bicep43// ❌ INSECURE - token visible in deployment history44// output deploymentToken string = staticWebApp.listSecrets().properties.apiKey45```4647## Terraform Deployment4849> ⚠️ **Use `azurerm_static_web_app`** — NOT Storage Account `static_website`.50> Storage Account static websites require anonymous blob access, which is blocked51> by enterprise Azure Policies. See [terraform.md](terraform.md) for correct patterns.5253Terraform-based deployments use `azd deploy` the same way as Bicep:5455```bash56azd deploy57```5859The `azd-service-name` tag on the `azurerm_static_web_app` resource tells azd where to deploy.6061**Do NOT do this** (exposes token in Terraform state):62```hcl63# ❌ INSECURE - token stored in Terraform state64# output "deployment_token" {65# value = azurerm_static_web_app.web.api_key66# sensitive = true67# }68```69