diff --git a/.azure-pipelines/ado.npmrc b/.azure-pipelines/ado.npmrc
new file mode 100644
index 0000000..0091267
--- /dev/null
+++ b/.azure-pipelines/ado.npmrc
@@ -0,0 +1,2 @@
+registry=https://msazure.pkgs.visualstudio.com/_packaging/LogicApps/npm/registry/
+always-auth=true
diff --git a/.azure-pipelines/docs-site-deploy.yml b/.azure-pipelines/docs-site-deploy.yml
new file mode 100644
index 0000000..5a0dab0
--- /dev/null
+++ b/.azure-pipelines/docs-site-deploy.yml
@@ -0,0 +1,332 @@
+# Azure DevOps Official pipeline for deploying the Astro documentation site
+# (docs-site/) to Azure Static Web Apps (Canary and Production).
+#
+# Replaces the mitigated GitHub Actions OIDC deploy jobs while keeping
+# credential-free PR builds in GitHub Actions.
+#
+# Security boundaries:
+# - Build stage runs completely credential-free on 1ES Ubuntu with KS4/CFSClean
+# network isolation, restoring npm dependencies via Azure Artifacts upstream
+# (.azure-pipelines/ado.npmrc) while preserving package-lock.json integrity hashes.
+# - Canary and Prod use separate Workload Identity Federation (WIF) service
+# connections backed by isolated User-Assigned Managed Identities scoped
+# strictly to their single SWA resource:
+# * otto-docs-canary-arm -> otto-docs-canary-swa (otto-docs-canary-rg)
+# * otto-docs-prod-arm -> otto-docs-swa (otto-docs-rg)
+# - Production additionally enforces ADO Branch Control (refs/heads/main +
+# refs/tags/release), Manual Approval, and Exclusive Lock on otto-docs-prod-arm,
+# plus a pipeline-level main-branch assertion.
+
+name: ${{ parameters.target }}-$(Date:yyyyMMdd)$(Rev:.r)
+
+trigger:
+ branches:
+ include:
+ - main
+ paths:
+ include:
+ - docs-site/**
+ - .azure-pipelines/docs-site-deploy.yml
+ - .azure-pipelines/ado.npmrc
+pr: none
+schedules: []
+
+parameters:
+ - name: target
+ displayName: 'Deployment target'
+ type: string
+ default: 'canary'
+ values:
+ - canary
+ - prod
+ - name: dryRun
+ displayName: 'Dry run (build, lockdown & config verification only; skip Azure login and SWA upload)'
+ type: boolean
+ default: false
+
+resources:
+ repositories:
+ - repository: 1esPipelines
+ type: git
+ name: 1ESPipelineTemplates/1ESPipelineTemplates
+ ref: refs/tags/release
+
+variables:
+ - name: isProd
+ value: ${{ eq(parameters.target, 'prod') }}
+ - name: npmMirrorRegistry
+ value: 'https://msazure.pkgs.visualstudio.com/_packaging/LogicApps/npm/registry/'
+ - name: swaCliVersion
+ value: '2.1.0'
+ - ${{ if eq(parameters.target, 'prod') }}:
+ - name: targetServiceConnection
+ value: 'otto-docs-prod-arm'
+ - name: targetResourceGroup
+ value: 'otto-docs-rg'
+ - name: targetSwaName
+ value: 'otto-docs-swa'
+ - name: targetExpectedFdid
+ value: 'fd12a176-4667-4e79-8d3d-0bd88e863ff7'
+ - name: targetPublicHost
+ value: 'auto.azure.com'
+ - name: targetPublicUrl
+ value: 'https://auto.azure.com/docs/'
+ - name: targetDirectUrl
+ value: 'https://kind-river-0d9e9ac1e.7.azurestaticapps.net/docs/'
+ - ${{ else }}:
+ - name: targetServiceConnection
+ value: 'otto-docs-canary-arm'
+ - name: targetResourceGroup
+ value: 'otto-docs-canary-rg'
+ - name: targetSwaName
+ value: 'otto-docs-canary-swa'
+ - name: targetExpectedFdid
+ value: '2ca9cd4d-6df1-47b7-b8e2-24ba2bd17727'
+ - name: targetPublicHost
+ value: 'otto-canary.azure.com'
+ - name: targetPublicUrl
+ value: 'https://otto-canary.azure.com/docs/'
+ - name: targetDirectUrl
+ value: 'https://lemon-mud-0e10bdd1e.7.azurestaticapps.net/docs/'
+
+extends:
+ template: v1/1ES.Official.PipelineTemplate.yml@1esPipelines
+ parameters:
+ pool:
+ name: Azure-Pipelines-1ESPT-ExDShared
+ image: ubuntu-latest
+ os: linux
+ sdl:
+ sourceAnalysisPool:
+ name: Azure-Pipelines-1ESPT-ExDShared
+ image: windows-latest
+ os: windows
+ stages:
+ - stage: Build
+ displayName: 'Build and validate docs site'
+ jobs:
+ - job: BuildDocs
+ displayName: 'Build Astro docs site (credential-free)'
+ timeoutInMinutes: 20
+ templateContext:
+ outputs:
+ - output: pipelineArtifact
+ targetPath: '$(Build.SourcesDirectory)/docs-site/dist'
+ artifactName: 'docs-dist'
+ steps:
+ - checkout: self
+ fetchDepth: 1
+
+ - task: UseNode@1
+ displayName: 'Use Node.js 22'
+ inputs:
+ version: '22.x'
+
+ - task: npmAuthenticate@0
+ displayName: 'Authenticate to LogicApps Azure Artifacts npm mirror'
+ inputs:
+ workingFile: '.azure-pipelines/ado.npmrc'
+
+ - task: Bash@3
+ displayName: 'Install, check, build, and validate docs site'
+ inputs:
+ targetType: inline
+ script: |
+ set -euo pipefail
+ export NPM_CONFIG_USERCONFIG="$(Build.SourcesDirectory)/.azure-pipelines/ado.npmrc"
+ cd docs-site
+
+ # Rewrite public registry.npmjs.org resolved URLs in the ephemeral workspace
+ # lockfile to the internal LogicApps upstream mirror (1ES CFSClean blocks direct
+ # registry.npmjs.org egress). Package integrity SHA-512 hashes remain untouched.
+ node -e '
+ const fs = require("node:fs");
+ const p = "package-lock.json";
+ const raw = fs.readFileSync(p, "utf8");
+ const updated = raw.replaceAll("https://registry.npmjs.org/", process.env.NPM_MIRROR_REGISTRY);
+ fs.writeFileSync(p, updated, "utf8");
+ '
+
+ npm ci --no-audit --no-fund
+ npm run check
+ npm run build
+ python3 -m unittest discover -s scripts/tests -p 'test_*.py'
+ python3 scripts/validate_docs_site.py
+ env:
+ NPM_MIRROR_REGISTRY: $(npmMirrorRegistry)
+
+ - stage: Deploy
+ displayName: 'Deploy docs site (${{ parameters.target }})'
+ dependsOn: Build
+ condition: succeeded()
+ jobs:
+ - job: DeployDocs
+ displayName: 'Lockdown and deploy to ${{ parameters.target }}'
+ timeoutInMinutes: 20
+ steps:
+ - checkout: self
+ fetchDepth: 1
+
+ - task: UseNode@1
+ displayName: 'Use Node.js 22'
+ inputs:
+ version: '22.x'
+
+ - task: DownloadPipelineArtifact@2
+ displayName: 'Download built docs-dist artifact'
+ inputs:
+ buildType: 'current'
+ artifactName: 'docs-dist'
+ targetPath: '$(Agent.TempDirectory)/swa-staging/dist'
+
+ - task: Bash@3
+ displayName: 'Enforce target branch guard and apply AFD lockdown'
+ inputs:
+ targetType: inline
+ script: |
+ set -euo pipefail
+ if [ "${IS_PROD}" = "True" ] && [ "${BUILD_SOURCEBRANCH}" != "refs/heads/main" ]; then
+ echo "##vso[task.logissue type=error]Production docs deploys are restricted to refs/heads/main (got '${BUILD_SOURCEBRANCH}')."
+ exit 1
+ fi
+
+ STAGING_DIR="$(Agent.TempDirectory)/swa-staging"
+ if [ ! -f "${STAGING_DIR}/dist/staticwebapp.config.json" ]; then
+ echo "##vso[task.logissue type=error]Missing staticwebapp.config.json in downloaded docs-dist artifact."
+ exit 1
+ fi
+
+ # Run apply-lockdown.mjs with cwd=STAGING_DIR so it mutates ./dist/staticwebapp.config.json
+ (
+ cd "${STAGING_DIR}"
+ node "$(Build.SourcesDirectory)/docs-site/scripts/apply-lockdown.mjs" "${DEPLOY_TARGET}"
+ )
+
+ # Verify forwardingGateway matches the expected Front Door ID before any upload
+ node -e '
+ const fs = require("node:fs");
+ const cfg = JSON.parse(fs.readFileSync(process.env.CONFIG_PATH, "utf8"));
+ const actualFdid = cfg?.forwardingGateway?.requiredHeaders?.["X-Azure-FDID"];
+ const hosts = cfg?.forwardingGateway?.allowedForwardedHosts;
+ if (actualFdid !== process.env.EXPECTED_FDID) {
+ console.error(`FDID mismatch: expected ${process.env.EXPECTED_FDID}, got ${actualFdid}`);
+ process.exit(1);
+ }
+ if (!Array.isArray(hosts) || hosts.length !== 1 || hosts[0] !== process.env.EXPECTED_HOST) {
+ console.error(`allowedForwardedHosts mismatch: expected [${process.env.EXPECTED_HOST}], got ${JSON.stringify(hosts)}`);
+ process.exit(1);
+ }
+ console.log("Verified forwardingGateway:", JSON.stringify(cfg.forwardingGateway));
+ '
+ env:
+ IS_PROD: $(isProd)
+ BUILD_SOURCEBRANCH: $(Build.SourceBranch)
+ DEPLOY_TARGET: ${{ parameters.target }}
+ CONFIG_PATH: $(Agent.TempDirectory)/swa-staging/dist/staticwebapp.config.json
+ EXPECTED_FDID: $(targetExpectedFdid)
+ EXPECTED_HOST: $(targetPublicHost)
+
+ - ${{ if eq(parameters.dryRun, true) }}:
+ - task: Bash@3
+ displayName: 'Dry run summary (skipping Azure login and SWA upload)'
+ inputs:
+ targetType: inline
+ script: |
+ set -euo pipefail
+ echo "dryRun=true — validated build, docs-dist artifact handoff, and AFD lockdown config for target=${DEPLOY_TARGET}."
+ echo "Would deploy $(Agent.TempDirectory)/swa-staging/dist to SWA ${TARGET_SWA} (RG ${TARGET_RG}) via ${TARGET_SC}."
+ ls -la "$(Agent.TempDirectory)/swa-staging/dist" | head -n 20
+ env:
+ DEPLOY_TARGET: ${{ parameters.target }}
+ TARGET_SWA: $(targetSwaName)
+ TARGET_RG: $(targetResourceGroup)
+ TARGET_SC: $(targetServiceConnection)
+
+ - ${{ if eq(parameters.dryRun, false) }}:
+ - task: npmAuthenticate@0
+ displayName: 'Authenticate to LogicApps Azure Artifacts npm mirror (SWA CLI)'
+ inputs:
+ workingFile: '.azure-pipelines/ado.npmrc'
+
+ # Install pinned SWA CLI before Azure login so no npm package resolution runs
+ # while WIF credentials or SWA_CLI_DEPLOYMENT_TOKEN are in scope.
+ - task: Bash@3
+ displayName: 'Install pinned SWA CLI (credential-free)'
+ inputs:
+ targetType: inline
+ script: |
+ set -euo pipefail
+ SWA_DIR="$(Agent.TempDirectory)/swa-cli"
+ mkdir -p "${SWA_DIR}"
+ export NPM_CONFIG_USERCONFIG="$(Build.SourcesDirectory)/.azure-pipelines/ado.npmrc"
+ npm install --prefix "${SWA_DIR}" --no-audit --no-fund --no-save "@azure/static-web-apps-cli@${SWA_CLI_VERSION}"
+ "${SWA_DIR}/node_modules/.bin/swa" --version
+ env:
+ SWA_CLI_VERSION: $(swaCliVersion)
+
+ - task: AzureCLI@2
+ displayName: 'Verify SWA Standard SKU and deploy via SWA CLI (WIF)'
+ inputs:
+ azureSubscription: '$(targetServiceConnection)'
+ scriptType: bash
+ scriptLocation: inlineScript
+ inlineScript: |
+ set -euo pipefail
+ SKU="$(az staticwebapp show \
+ --resource-group "${TARGET_RG}" \
+ --name "${TARGET_SWA}" \
+ --query 'sku.name' -o tsv)"
+ echo "Target SWA ${TARGET_SWA} SKU: ${SKU}"
+ if [ "${SKU}" != "Standard" ]; then
+ echo "##vso[task.logissue type=error]Refusing deploy: ${TARGET_SWA} is on SKU '${SKU}'. Standard SKU is required so forwardingGateway lockdown is enforced."
+ exit 1
+ fi
+
+ DEPLOY_TOKEN="$(az staticwebapp secrets list \
+ --resource-group "${TARGET_RG}" \
+ --name "${TARGET_SWA}" \
+ --query 'properties.apiKey' -o tsv)"
+ if [ -z "${DEPLOY_TOKEN}" ]; then
+ echo "##vso[task.logissue type=error]Failed to retrieve SWA deployment token for ${TARGET_SWA}."
+ exit 1
+ fi
+ echo "##vso[task.setsecret]${DEPLOY_TOKEN}"
+
+ STAGING_DIST="$(Agent.TempDirectory)/swa-staging/dist"
+ SWA_BIN="$(Agent.TempDirectory)/swa-cli/node_modules/.bin/swa"
+ SWA_CLI_DEPLOYMENT_TOKEN="${DEPLOY_TOKEN}" "${SWA_BIN}" deploy "${STAGING_DIST}" \
+ --swa-config-location "${STAGING_DIST}" \
+ --env production \
+ --no-use-keychain
+ env:
+ TARGET_RG: $(targetResourceGroup)
+ TARGET_SWA: $(targetSwaName)
+
+ - task: Bash@3
+ displayName: 'Post-deploy smoke probes (AFD 200 and direct origin 403)'
+ inputs:
+ targetType: inline
+ script: |
+ set -euo pipefail
+ check_status() {
+ local label="$1"
+ local url="$2"
+ local expected="$3"
+ local code=""
+ for attempt in 1 2 3 4 5; do
+ code="$(curl -sS -o /dev/null -w '%{http_code}' --max-time 20 "${url}" || echo '000')"
+ echo "[attempt ${attempt}] ${label} (${url}) -> HTTP ${code} (expected ${expected})"
+ if [ "${code}" = "${expected}" ]; then
+ return 0
+ fi
+ sleep 10
+ done
+ echo "##vso[task.logissue type=error]${label} probe failed: expected HTTP ${expected}, last got ${code}."
+ return 1
+ }
+
+ check_status "AFD public docs" "${TARGET_PUBLIC_URL}" "200"
+ check_status "Direct SWA origin lockdown" "${TARGET_DIRECT_URL}" "403"
+ env:
+ TARGET_PUBLIC_URL: $(targetPublicUrl)
+ TARGET_DIRECT_URL: $(targetDirectUrl)
diff --git a/.github/workflows/docs-site-deploy.yml b/.github/workflows/docs-site-deploy.yml
index 5157f33..003706d 100644
--- a/.github/workflows/docs-site-deploy.yml
+++ b/.github/workflows/docs-site-deploy.yml
@@ -1,30 +1,13 @@
-# Docs Site — Azure Static Web Apps Deploy (canary + prod)
+# Docs Site — Build & Link Validation (GitHub Actions, credential-free)
#
-# Builds the Astro/Starlight docs site once and deploys to the appropriate
-# Azure Static Web App. All Azure auth flows through workload-identity
-# federation (OIDC) against the shared `Otto E2E GitHub Actions` SP — no
-# long-lived deployment tokens are stored anywhere in this repo.
+# Runs fast, credential-free type-checking, Astro build, and docs link/fragment
+# validation on pull requests and pushes to `main`.
#
-# Triggers:
-# push (main, docs-site/**) → canary auto-deploy
-# pull_request (opened/sync/reopened) → canary preview environment
-# pull_request (closed) → tear down preview environment
-# workflow_dispatch (target=canary|prod) → manual deploy (prod requires
-# approval via the `docs-prod`
-# GitHub environment)
-#
-# Required repo configuration (Settings → Secrets and variables → Actions):
-# Secrets: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_SUBSCRIPTION_ID
-# Optional vars: DOCS_SITE_URL (canonical site URL used in )
-#
-# Required GitHub environment: `docs-prod` (with required reviewers).
-#
-# Resources:
-# Canary SWA: otto-docs-canary-swa (RG: otto-docs-canary-rg)
-# hostname: lemon-mud-0e10bdd1e.7.azurestaticapps.net
-# Prod SWA: otto-docs-swa (RG: otto-docs-rg)
-# hostname: kind-river-0d9e9ac1e.7.azurestaticapps.net
-# fronted by AFD `otto-portal-afd` at https://auto.azure.com/docs/
+# Canary and Production Azure Static Web Apps deployments run on Azure DevOps
+# (1ES Official pipeline `Logic-Apps-Automation-Docs`, definition 490778) using
+# isolated Workload Identity Federation (WIF) service connections defined in
+# `.azure-pipelines/docs-site-deploy.yml`. No Azure credentials or deployment
+# tokens are used in GitHub Actions.
name: 'Docs Site: Deploy'
@@ -35,29 +18,18 @@ on:
- 'docs-site/**'
- '.github/workflows/docs-site-deploy.yml'
pull_request:
- types: [opened, synchronize, reopened, closed]
+ types: [opened, synchronize, reopened]
paths:
- 'docs-site/**'
- '.github/workflows/docs-site-deploy.yml'
- workflow_dispatch:
- inputs:
- target:
- description: 'Deploy target'
- type: choice
- options: [canary, prod]
- default: canary
-# Default permissions = read only; jobs opt-in to what they need.
+# Read-only permissions; this workflow never authenticates to Azure.
permissions:
contents: read
-# Concurrency by resolved target so that:
-# - PRs: each PR has its own group (preview deploy can be cancelled by a new push)
-# - push to main and manual canary: share the `canary` group (cancel one another)
-# - manual prod: lives in its own `prod` group and is never auto-cancelled
concurrency:
- group: docs-site-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || (github.event_name == 'workflow_dispatch' && inputs.target) || 'canary' }}
- cancel-in-progress: ${{ !(github.event_name == 'workflow_dispatch' && inputs.target == 'prod') }}
+ group: docs-site-build-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || github.ref }}
+ cancel-in-progress: true
env:
NODE_VERSION: '22'
@@ -66,13 +38,11 @@ env:
jobs:
# --------------------------------------------------------------------------
- # Build once. The same artifact is deployed to whichever target the job
- # graph selects. `base: '/docs'` is baked into astro.config.mjs so there's
- # no per-target build divergence.
+ # Credential-free build and validation. Preserves the `Build` job name for
+ # branch protection checks.
# --------------------------------------------------------------------------
build:
name: 'Build'
- if: github.event_name != 'pull_request' || github.event.action != 'closed'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
@@ -118,227 +88,3 @@ jobs:
path: ${{ env.DOCS_APP_LOCATION }}/${{ env.DOCS_OUTPUT_LOCATION }}
retention-days: 7
if-no-files-found: error
-
- # --------------------------------------------------------------------------
- # Deploy → canary. Triggered by push to main, by PR previews from in-repo
- # branches, or by manual dispatch with target=canary (also restricted to
- # main because that's the only ref the SP's federated credential covers
- # for non-PR runs). Fork PRs lack access to secrets and so this job will
- # skip cleanly (azure/login won't be invoked).
- # --------------------------------------------------------------------------
- deploy_canary:
- name: 'Deploy → canary'
- needs: build
- if: |
- (github.event_name == 'push') ||
- (github.event_name == 'pull_request' &&
- github.event.action != 'closed' &&
- github.event.pull_request.head.repo.full_name == github.repository) ||
- (github.event_name == 'workflow_dispatch' &&
- inputs.target == 'canary' &&
- github.ref == 'refs/heads/main')
- runs-on: ubuntu-latest
- timeout-minutes: 10
- permissions:
- contents: read
- id-token: write
- pull-requests: write
- env:
- SWA_NAME: otto-docs-canary-swa
- SWA_RG: otto-docs-canary-rg
- steps:
- - name: Checkout (lockdown script only)
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- with:
- sparse-checkout: |
- docs-site/scripts/apply-lockdown.mjs
- sparse-checkout-cone-mode: false
-
- - name: Download built site
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- with:
- name: docs-dist
- path: dist
-
- # PR previews are served on per-PR `*-.eastus2.7.azurestaticapps.net`
- # hosts that AFD does not front — locking them down would 403 the
- # reviewer. So we only inject the AFD `forwardingGateway` block for the
- # canary `production` environment (push / workflow_dispatch runs).
- - name: Apply canary AFD lockdown (skip for PR previews)
- if: github.event_name != 'pull_request'
- shell: bash
- run: node docs-site/scripts/apply-lockdown.mjs canary
-
- - name: Verify Azure auth secrets are configured
- shell: bash
- env:
- AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
- AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
- AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- run: |
- set -euo pipefail
- missing=()
- [[ -z "$AZURE_CLIENT_ID" ]] && missing+=("AZURE_CLIENT_ID")
- [[ -z "$AZURE_TENANT_ID" ]] && missing+=("AZURE_TENANT_ID")
- [[ -z "$AZURE_SUBSCRIPTION_ID" ]] && missing+=("AZURE_SUBSCRIPTION_ID")
- if (( ${#missing[@]} > 0 )); then
- echo "::error::Missing required repo secrets: ${missing[*]}"
- echo "::error::See docs-site/INFRA.md → 'Repo-side one-time setup' for how to configure these."
- exit 1
- fi
-
- - name: Azure login (OIDC)
- uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0
- with:
- client-id: ${{ secrets.AZURE_CLIENT_ID }}
- tenant-id: ${{ secrets.AZURE_TENANT_ID }}
- subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
-
- - name: Fetch SWA deployment token (JIT)
- id: token
- shell: bash
- run: |
- set -euo pipefail
- TOKEN=$(az staticwebapp secrets list \
- --name "$SWA_NAME" --resource-group "$SWA_RG" \
- --query properties.apiKey -o tsv)
- echo "::add-mask::$TOKEN"
- echo "swa_token=$TOKEN" >> "$GITHUB_OUTPUT"
-
- - name: Deploy to Azure Static Web Apps (canary)
- uses: Azure/static-web-apps-deploy@1a947af9992250f3bc2e68ad0754c0b0c11566c9 # v1
- with:
- azure_static_web_apps_api_token: ${{ steps.token.outputs.swa_token }}
- repo_token: ${{ secrets.GITHUB_TOKEN }}
- action: 'upload'
- app_location: 'dist'
- skip_app_build: true
- skip_api_build: true
-
- # --------------------------------------------------------------------------
- # Deploy → prod. Only triggered manually. The `docs-prod` GitHub environment
- # gates this job with required reviewers, so production never deploys without
- # an explicit approval click.
- # --------------------------------------------------------------------------
- deploy_prod:
- name: 'Deploy → prod'
- needs: build
- if: github.event_name == 'workflow_dispatch' && inputs.target == 'prod'
- runs-on: ubuntu-latest
- timeout-minutes: 10
- environment:
- name: docs-prod
- url: https://auto.azure.com/docs/
- permissions:
- contents: read
- id-token: write
- env:
- SWA_NAME: otto-docs-swa
- SWA_RG: otto-docs-rg
- steps:
- - name: Checkout (lockdown script only)
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- with:
- sparse-checkout: |
- docs-site/scripts/apply-lockdown.mjs
- sparse-checkout-cone-mode: false
-
- - name: Download built site
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- with:
- name: docs-dist
- path: dist
-
- - name: Apply prod AFD lockdown
- shell: bash
- run: node docs-site/scripts/apply-lockdown.mjs prod
-
- - name: Verify Azure auth secrets are configured
- shell: bash
- env:
- AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
- AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
- AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- run: |
- set -euo pipefail
- missing=()
- [[ -z "$AZURE_CLIENT_ID" ]] && missing+=("AZURE_CLIENT_ID")
- [[ -z "$AZURE_TENANT_ID" ]] && missing+=("AZURE_TENANT_ID")
- [[ -z "$AZURE_SUBSCRIPTION_ID" ]] && missing+=("AZURE_SUBSCRIPTION_ID")
- if (( ${#missing[@]} > 0 )); then
- echo "::error::Missing required repo secrets: ${missing[*]}"
- echo "::error::See docs-site/INFRA.md → 'Repo-side one-time setup' for how to configure these."
- exit 1
- fi
-
- - name: Azure login (OIDC)
- uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0
- with:
- client-id: ${{ secrets.AZURE_CLIENT_ID }}
- tenant-id: ${{ secrets.AZURE_TENANT_ID }}
- subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
-
- - name: Fetch SWA deployment token (JIT)
- id: token
- shell: bash
- run: |
- set -euo pipefail
- TOKEN=$(az staticwebapp secrets list \
- --name "$SWA_NAME" --resource-group "$SWA_RG" \
- --query properties.apiKey -o tsv)
- echo "::add-mask::$TOKEN"
- echo "swa_token=$TOKEN" >> "$GITHUB_OUTPUT"
-
- - name: Deploy to Azure Static Web Apps (prod)
- uses: Azure/static-web-apps-deploy@1a947af9992250f3bc2e68ad0754c0b0c11566c9 # v1
- with:
- azure_static_web_apps_api_token: ${{ steps.token.outputs.swa_token }}
- repo_token: ${{ secrets.GITHUB_TOKEN }}
- action: 'upload'
- app_location: 'dist'
- skip_app_build: true
- skip_api_build: true
-
- # --------------------------------------------------------------------------
- # Close PR preview. Only same-repo PRs created a preview; only same-repo
- # PR closures can tear one down (forks can't access the token).
- # --------------------------------------------------------------------------
- close_pr_preview:
- name: 'Close PR preview'
- if: |
- github.event_name == 'pull_request' &&
- github.event.action == 'closed' &&
- github.event.pull_request.head.repo.full_name == github.repository
- runs-on: ubuntu-latest
- timeout-minutes: 5
- permissions:
- contents: read
- id-token: write
- pull-requests: write
- env:
- SWA_NAME: otto-docs-canary-swa
- SWA_RG: otto-docs-canary-rg
- steps:
- - name: Azure login (OIDC)
- uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0
- with:
- client-id: ${{ secrets.AZURE_CLIENT_ID }}
- tenant-id: ${{ secrets.AZURE_TENANT_ID }}
- subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
-
- - name: Fetch SWA deployment token (JIT)
- id: token
- shell: bash
- run: |
- set -euo pipefail
- TOKEN=$(az staticwebapp secrets list \
- --name "$SWA_NAME" --resource-group "$SWA_RG" \
- --query properties.apiKey -o tsv)
- echo "::add-mask::$TOKEN"
- echo "swa_token=$TOKEN" >> "$GITHUB_OUTPUT"
-
- - name: Close preview environment
- uses: Azure/static-web-apps-deploy@1a947af9992250f3bc2e68ad0754c0b0c11566c9 # v1
- with:
- azure_static_web_apps_api_token: ${{ steps.token.outputs.swa_token }}
- action: 'close'
\ No newline at end of file
diff --git a/docs-site/INFRA.md b/docs-site/INFRA.md
index 468f24b..0c4b6d8 100644
--- a/docs-site/INFRA.md
+++ b/docs-site/INFRA.md
@@ -1,11 +1,11 @@
# Otto Docs Site — Infrastructure
The docs site is an Astro/Starlight build hosted on Azure Static Web Apps.
-There are two SWAs — one for canary (auto-deploys on every push to `main`)
-and one for prod (gated, manual). Both build from the same source with the
-same `base: '/docs'` config and are fronted by Azure Front Door — direct
-hits on the `*.azurestaticapps.net` hostnames return 403 by design (see
-**Lockdown** below).
+There are two SWAs — one for canary (auto-deploys on every push to `main` via
+Azure DevOps) and one for prod (manual, approval-gated on `main`). Both build
+from the same source with the same `base: '/docs'` config and are fronted by
+Azure Front Door — direct hits on the `*.azurestaticapps.net` hostnames return
+403 by design (see **Lockdown** below).
This is independent of the portal — a docs deploy can never block a runtime
release.
@@ -19,68 +19,57 @@ release.
| Resource group | `otto-docs-canary-rg` (`westus2`) | `otto-docs-rg` (`westus2`) |
| Static Web App | `otto-docs-canary-swa` (**Standard** SKU) | `otto-docs-swa` (**Standard** SKU) |
| Default hostname | `https://lemon-mud-0e10bdd1e.7.azurestaticapps.net` (403 — locked down) | `https://kind-river-0d9e9ac1e.7.azurestaticapps.net` (403 — locked down) |
-| Public URL | `https://otto-canary.azure.com/docs/` via AFD `otto-portal-canary-afd` | `https://auto.azure.com/docs/` via AFD `otto-portal-afd` |
-| AFD `frontDoorId` | `2ca9cd4d-6df1-47b7-b8e2-24ba2bd17727` | `c1504f11-9bfe-40e3-b58f-923f88dc0689` |
+| Public URL | `https://otto-canary.azure.com/docs/` via AFD `otto-portal-canary-afd` | `https://auto.azure.com/docs/` via AFD `auto-portal-afd` |
+| AFD `frontDoorId` | `2ca9cd4d-6df1-47b7-b8e2-24ba2bd17727` | `fd12a176-4667-4e79-8d3d-0bd88e863ff7` |
+| Deploy UAMI | `otto-docs-canary-deploy-mi` (`otto-docs-canary-rg`) | `otto-docs-prod-deploy-mi` (`otto-docs-rg`) |
+| ADO Service Connection | `otto-docs-canary-arm` | `otto-docs-prod-arm` |
| Tags | `environment=canary` | `environment=prod` |
Both SWAs share `project=otto-docs`, `team=serverless-paas`,
`owner=krmitta@microsoft.com`.
Standard SKU is required for `forwardingGateway` enforcement; Free SKU
-silently ignores it. The two SKUs cost ~$9/SWA/month. PR preview
-environments use the same Standard SWA but skip the lockdown injection
-(see **Lockdown** below), so each preview is reachable directly on its
-auto-generated `*-.eastus2.7.azurestaticapps.net` host.
+silently ignores it. The two SKUs cost ~$9/SWA/month.
## CI/CD
| Item | Value |
| --- | --- |
-| Workflow | [`.github/workflows/docs-site-deploy.yml`](../.github/workflows/docs-site-deploy.yml) |
-| Deploy action | [`Azure/static-web-apps-deploy@v1`](https://github.com/Azure/static-web-apps-deploy) |
-| Build | Single Astro build per run; the same artifact deploys to canary and/or prod. Per-target lockdown is layered in just before deploy by [`docs-site/scripts/apply-lockdown.mjs`](./scripts/apply-lockdown.mjs). |
-| Auth | GitHub OIDC — no long-lived deployment tokens stored anywhere. |
+| PR & main build validation | [`.github/workflows/docs-site-deploy.yml`](../.github/workflows/docs-site-deploy.yml) (GitHub Actions, credential-free) |
+| Canary & Prod deployment | [`.azure-pipelines/docs-site-deploy.yml`](../.azure-pipelines/docs-site-deploy.yml) (Azure DevOps 1ES Official pipeline `Logic-Apps-Automation-Docs`, definition `490778` in `msazure/One`) |
+| Deploy tool | `@azure/static-web-apps-cli@2` (`swa deploy`) |
+| Build | Credential-free Astro build on 1ES Ubuntu with `CFSClean` network isolation, restoring packages through the `LogicApps` Azure Artifacts npm upstream (`.azure-pipelines/ado.npmrc`). Per-target AFD lockdown is injected before deploy by [`docs-site/scripts/apply-lockdown.mjs`](./scripts/apply-lockdown.mjs). |
+| Auth | Azure DevOps Workload Identity Federation (WIF) backed by isolated single-SWA User-Assigned Managed Identities — no stored secrets or deployment tokens. |
| Trigger | Action |
| --- | --- |
-| `push` to `main` on `docs-site/**` | Build → deploy canary (with canary lockdown) |
-| `pull_request` from in-repo branch | Build → deploy preview environment on canary SWA (no lockdown) |
-| `pull_request` from fork | Build only (no secret access) |
-| `pull_request` closed | Tear down preview environment |
-| `workflow_dispatch` target=`canary` | Build → deploy canary (only allowed from `refs/heads/main`) |
-| `workflow_dispatch` target=`prod` | Build → deploy prod (gated by `docs-prod` environment reviewers) |
+| `pull_request` on `docs-site/**` | GitHub Actions: credential-free `npm run check`, `npm run build`, Python link checker tests & validation |
+| `push` to `main` on `docs-site/**` or `.azure-pipelines/*` | Azure DevOps (`490778`): build, validate, apply canary lockdown, deploy to `otto-docs-canary-swa`, run AFD `200` + direct origin `403` smoke probes |
+| Manual ADO run (`target=canary`) | Build and deploy canary (`dryRun=true` validates build & lockdown without Azure login or upload) |
+| Manual ADO run (`target=prod`, `main` only) | Gated by ADO Branch Control (`refs/heads/main`, `refs/tags/release`), Manual Approval, and Exclusive Lock on `otto-docs-prod-arm` → build, apply prod lockdown, deploy to `otto-docs-swa`, run AFD `200` + direct origin `403` smoke probes |
-### Auth model (no stored credentials)
+### Auth model (isolated WIF, no stored credentials)
-All Azure operations flow through the shared **Otto E2E GitHub Actions** SP
-(reused across docs and portal canary workflows). There are no docs-specific
-GitHub secrets beyond the org-wide Azure identity.
+Canary and Production use separate User-Assigned Managed Identities (UAMIs)
+and separate Azure DevOps Workload Identity Federation service connections in
+`msazure/One`. Each UAMI has `Contributor` scoped strictly to its single Static
+Web App resource (not the resource group or subscription), and each ADO service
+connection is authorized strictly for pipeline `490778`.
-| Identity | Otto E2E GitHub Actions (`appId e8323013-aff3-46b9-8f7e-96ea41edf48a`) |
-| --- | --- |
-| Tenant | `72f988bf-86f1-41af-91ab-2d7cd011db47` |
-| Required GitHub secrets | `AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_SUBSCRIPTION_ID` |
-| Federated credentials | `repository_owner_id:6844498:repository_id:1250745995:ref:refs/heads/main` (push), `…:pull_request` (PR previews), `…:environment:docs-prod` (gated prod deploys) |
-| Role on canary RG | `Contributor` scoped only to `otto-docs-canary-rg` |
-| Role on prod RG | `Contributor` scoped only to `otto-docs-rg` |
-
-> **Subject format caveat.** The Azure GitHub organisation overrides OIDC
-> subject claims to be **ID-based**, not name-based — `repository_owner_id`
-> and `repository_id` numeric IDs replace the org/repo names. Federated
-> credentials whose subject uses the legacy `repo:Azure/Logic-Apps-Automation:…`
-> format silently fail to match (AADSTS700213). Always use the numeric form
-> for new credentials. Owner ID `6844498` = `Azure`; repo ID `1250745995` =
-> `Logic-Apps-Automation`.
+| Setting | Canary | Prod |
+| --- | --- | --- |
+| UAMI | `otto-docs-canary-deploy-mi` (`clientId: defd84eb-b8ce-42f3-a48f-f2910c03f637`) | `otto-docs-prod-deploy-mi` (`clientId: bf93dbf3-f90f-40c0-be40-8a4617150e2e`) |
+| RBAC scope | `Contributor` on `/subscriptions/49cff46c-0b82-4a1b-a533-ede69747bb0b/resourceGroups/otto-docs-canary-rg/providers/Microsoft.Web/staticSites/otto-docs-canary-swa` | `Contributor` on `/subscriptions/49cff46c-0b82-4a1b-a533-ede69747bb0b/resourceGroups/otto-docs-rg/providers/Microsoft.Web/staticSites/otto-docs-swa` |
+| ADO Service Connection | `otto-docs-canary-arm` | `otto-docs-prod-arm` |
+| Pipeline permissions | Pipeline `490778` only (`allPipelines: false`) | Pipeline `490778` only (`allPipelines: false`) |
+| ADO Checks | Exclusive Lock (+ Branch Control `refs/heads/main,refs/tags/release`) | Exclusive Lock + Branch Control (`refs/heads/main,refs/tags/release`) + Manual Approval |
End-to-end auth flow per deploy:
-1. GitHub Actions mints a short-lived OIDC token for the workflow run.
-2. `azure/login@v2` exchanges that token (via the federated credential trust)
- for an Azure access token tied to the SP.
-3. The workflow calls `az staticwebapp secrets list` against the target SWA
- (canary or prod RG depending on the job) to fetch the deployment token
- just-in-time. The token is masked in logs and never persisted.
-4. `Azure/static-web-apps-deploy@v1` performs an atomic upload.
+1. The 1ES Build stage builds and validates `docs-site/dist` completely credential-free and publishes the `docs-dist` pipeline artifact.
+2. The Deploy stage verifies the target branch guard, injects `forwardingGateway` via `docs-site/scripts/apply-lockdown.mjs`, and authenticates through `AzureCLI@2` using ADO WIF (`otto-docs-canary-arm` or `otto-docs-prod-arm`).
+3. The Deploy step verifies the target SWA is on `Standard` SKU, fetches the deployment token just-in-time via `az staticwebapp secrets list`, masks it (`##vso[task.setsecret]`), and passes it via `SWA_CLI_DEPLOYMENT_TOKEN` to `npx @azure/static-web-apps-cli@2 deploy` with `--swa-config-location` pinned to the locked-down staging directory.
+4. Post-deploy smoke probes assert HTTP `200` on the public AFD URL and HTTP `403` on the direct `*.azurestaticapps.net` origin.
To rotate (or after a suspected leak):
@@ -92,36 +81,21 @@ az staticwebapp secrets reset-api-key --name otto-docs-canary-swa --resource-gro
az staticwebapp secrets reset-api-key --name otto-docs-swa --resource-group otto-docs-rg
```
-No workflow or GH-secret change is needed after rotation — the workflow
-fetches the new token on the next run.
-
-### Preview environments for in-repo PRs
-
-In-repo PRs each get a preview environment hosted by the canary SWA.
-Fork PRs build but don't deploy (GitHub does not pass secrets to fork
-workflows, by design). A canary `workflow_dispatch` run is restricted to
-`main`; it can't deploy a fork PR's branch directly.
-
-Closing or merging the PR automatically tears down the preview (the
-`close_pr_preview` job). Preview deploys intentionally skip the
-`apply-lockdown.mjs` step so the auto-generated preview hostname is
-reachable directly — the reviewer can open the link without going through
-AFD.
+No pipeline or secret-store update is needed after rotation — the deploy stage
+fetches the new token just-in-time on the next run.
## Front Door routing
-Both environments are fronted by their own AFD profile in the same
-subscription:
+Both environments are fronted by Azure Front Door:
| AFD piece | Canary | Prod |
| --- | --- | --- |
-| Profile | `otto-portal-canary-afd` (RG `otto-portal-canary-rg`) | `otto-portal-afd` (RG `otto-portal-rg`) |
-| Endpoint | `otto-portal-canary` | `otto-portal` |
-| Custom domain | `otto-canary` (`otto-canary.azure.com`, AFD-managed cert) | `auto-azure-com` (`auto.azure.com`, AFD-managed cert) |
-| Docs origin group | `otto-docs-canary-origins` (probe `HEAD /`, HTTPS, 100s) | `otto-docs-origins` |
-| Docs origin | `otto-docs-canary-swa` → `lemon-mud-0e10bdd1e.7.azurestaticapps.net` | `otto-docs-swa-origin` → `kind-river-0d9e9ac1e.7.azurestaticapps.net` |
-| Docs route | `docs-route` — `patternsToMatch: ['/docs', '/docs/*']`, HTTPS only, `linkToDefaultDomain: Disabled` | same |
-| Default route | `default-route` — `/*` → portal ACA origins | same |
+| Profile | `otto-portal-canary-afd` (RG `otto-portal-canary-rg`, sub `49cff46c-0b82-4a1b-a533-ede69747bb0b`) | `auto-portal-afd` (RG `auto-portal-afd-rg`, sub `4bb604d0-3eaa-4194-ab38-26cdc69a7f44`) |
+| Custom domain | `otto-canary.azure.com` (AFD-managed cert) | `auto.azure.com` (AFD-managed cert) |
+| AFD `frontDoorId` | `2ca9cd4d-6df1-47b7-b8e2-24ba2bd17727` | `fd12a176-4667-4e79-8d3d-0bd88e863ff7` |
+| Docs origin | `lemon-mud-0e10bdd1e.7.azurestaticapps.net` | `kind-river-0d9e9ac1e.7.azurestaticapps.net` |
+| Docs route | `patternsToMatch: ['/docs', '/docs/*']`, HTTPS only, `linkToDefaultDomain: Disabled` | same |
+| Default route | `/*` → portal ACA origins | same |
The portal's `default-route` (matching `/*` → portal ACA origins) and the
`docs-route` coexist on the same endpoint; AFD picks the more specific
@@ -139,8 +113,8 @@ all traffic must come through the registered custom domain.
We never want users to discover and bookmark the raw
`*.azurestaticapps.net` URL — that bypasses our AFD WAF, rule sets, custom
-domain, and CDN. Both production SWAs are configured to reject any request
-that doesn't carry the expected AFD identifier headers.
+domain, and CDN. Both SWAs are configured to reject any request that doesn't
+carry the expected AFD identifier headers.
This works through the `forwardingGateway` block injected into
`dist/staticwebapp.config.json` by
@@ -164,10 +138,9 @@ but a request via `https://auto.azure.com/docs/` passes through.
| Caveat | Detail |
| --- | --- |
-| **SKU** | `forwardingGateway` is enforced only on **Standard** SKU. Free SKU silently ignores it. |
-| **Single FDID per env** | Each SWA pins to exactly one AFD profile via `requiredHeaders`; we can't share a single SWA across canary and prod AFDs. Per-env injection is therefore required and lives in the deploy workflow. |
-| **PR previews** | Preview environments inherit a non-fronted hostname; the workflow `if: github.event_name != 'pull_request'` guard skips lockdown so PR reviewers can open the preview link directly. |
-| **`X-Azure-FDID` is per-profile** | Stamped on every AFD response and discoverable in the Azure Portal / via `az afd profile show -o json --query frontDoorId`. Update [`apply-lockdown.mjs`](./scripts/apply-lockdown.mjs) if the AFD profile is ever recreated. |
+| **SKU** | `forwardingGateway` is enforced only on **Standard** SKU. Free SKU silently ignores it. The deploy pipeline fails fast if the target SWA is not on `Standard` SKU. |
+| **Single FDID per env** | Each SWA pins to exactly one AFD profile via `requiredHeaders`; we can't share a single SWA across canary and prod AFDs. Per-env injection is therefore required and lives in the deploy pipeline. |
+| **`X-Azure-FDID` is per-profile** | Stamped on every AFD response and discoverable in the Azure Portal / via `az afd profile show -o json --query frontDoorId`. Update [`apply-lockdown.mjs`](./scripts/apply-lockdown.mjs) if the AFD profile is ever recreated or cut over. |
Verification (post-deploy):
@@ -203,88 +176,54 @@ az staticwebapp create --name otto-docs-swa --resource-group otto-docs-rg \
--location westus2 --sku Standard \
--tags environment=prod project=otto-docs team=serverless-paas owner=krmitta@microsoft.com
-# ---- SP identity (reuses the existing Otto E2E SP) -----------------------
-SP_APP_ID=e8323013-aff3-46b9-8f7e-96ea41edf48a
-SP_APP_OBJ=bb38355a-93e6-40d9-8b6a-47edbe32f017
-SP_OBJ_ID=$(az ad sp show --id "$SP_APP_ID" --query id -o tsv)
-
-# Contributor scoped to each docs RG (least privilege)
-for RG in otto-docs-canary-rg otto-docs-rg; do
- az role assignment create \
- --assignee-object-id "$SP_OBJ_ID" \
- --assignee-principal-type ServicePrincipal \
- --role Contributor \
- --scope "/subscriptions/$SUB/resourceGroups/$RG"
-done
-
-# Federated credentials for this repo (Azure/Logic-Apps-Automation).
-# Subject format MUST be ID-based to match the Azure org's OIDC claim
-# customization — name-based subjects silently fail with AADSTS700213.
-REPO_OWNER_ID=6844498 # Azure
-REPO_ID=1250745995 # Logic-Apps-Automation
-for cred in \
- "{\"name\":\"laa-main-numeric\",\"issuer\":\"https://token.actions.githubusercontent.com\",\"subject\":\"repository_owner_id:$REPO_OWNER_ID:repository_id:$REPO_ID:ref:refs/heads/main\",\"description\":\"docs canary deploys on main push\",\"audiences\":[\"api://AzureADTokenExchange\"]}" \
- "{\"name\":\"laa-pr-numeric\",\"issuer\":\"https://token.actions.githubusercontent.com\",\"subject\":\"repository_owner_id:$REPO_OWNER_ID:repository_id:$REPO_ID:pull_request\",\"description\":\"docs PR preview deploys\",\"audiences\":[\"api://AzureADTokenExchange\"]}" \
- "{\"name\":\"laa-env-docs-prod-numeric\",\"issuer\":\"https://token.actions.githubusercontent.com\",\"subject\":\"repository_owner_id:$REPO_OWNER_ID:repository_id:$REPO_ID:environment:docs-prod\",\"description\":\"docs prod gated deploys\",\"audiences\":[\"api://AzureADTokenExchange\"]}"
-do
- az ad app federated-credential create --id "$SP_APP_OBJ" --parameters "$cred"
-done
-
-# ---- AFD docs routing ----------------------------------------------------
-# Prod (existing portal AFD)
-PROD_PROFILE=otto-portal-afd
-PROD_AFD_RG=otto-portal-rg
-PROD_ENDPOINT=otto-portal
-PROD_CD=auto-azure-com # custom-domain resource name for auto.azure.com
-PROD_SWA_HOST=kind-river-0d9e9ac1e.7.azurestaticapps.net
-
-az afd origin-group create --profile-name $PROD_PROFILE --resource-group $PROD_AFD_RG \
- --origin-group-name otto-docs-origins \
- --probe-protocol Https --probe-path / --probe-request-type HEAD --probe-interval-in-seconds 100 \
- --sample-size 4 --successful-samples-required 3 --additional-latency-in-milliseconds 50
-az afd origin create --profile-name $PROD_PROFILE --resource-group $PROD_AFD_RG \
- --origin-group-name otto-docs-origins --origin-name otto-docs-swa-origin \
- --host-name $PROD_SWA_HOST --origin-host-header $PROD_SWA_HOST \
- --https-port 443 --priority 1 --weight 1000 --enabled-state Enabled
-az afd route create --profile-name $PROD_PROFILE --resource-group $PROD_AFD_RG \
- --endpoint-name $PROD_ENDPOINT --route-name docs-route \
- --origin-group otto-docs-origins --custom-domains $PROD_CD \
- --patterns-to-match '/docs' '/docs/*' \
- --supported-protocols Http Https --forwarding-protocol HttpsOnly \
- --https-redirect Enabled --link-to-default-domain Disabled
-
-# Canary (mirror)
-CANARY_PROFILE=otto-portal-canary-afd
-CANARY_AFD_RG=otto-portal-canary-rg
-CANARY_ENDPOINT=otto-portal-canary
-CANARY_CD=otto-canary # custom-domain resource name for otto-canary.azure.com
-CANARY_SWA_HOST=lemon-mud-0e10bdd1e.7.azurestaticapps.net
-
-az afd origin-group create --profile-name $CANARY_PROFILE --resource-group $CANARY_AFD_RG \
- --origin-group-name otto-docs-canary-origins \
- --probe-protocol Https --probe-path / --probe-request-type HEAD --probe-interval-in-seconds 100 \
- --sample-size 4 --successful-samples-required 3 --additional-latency-in-milliseconds 50
-az afd origin create --profile-name $CANARY_PROFILE --resource-group $CANARY_AFD_RG \
- --origin-group-name otto-docs-canary-origins --origin-name otto-docs-canary-swa \
- --host-name $CANARY_SWA_HOST --origin-host-header $CANARY_SWA_HOST \
- --https-port 443 --priority 1 --weight 1000 --enabled-state Enabled
-az afd route create --profile-name $CANARY_PROFILE --resource-group $CANARY_AFD_RG \
- --endpoint-name $CANARY_ENDPOINT --route-name docs-route \
- --origin-group otto-docs-canary-origins --custom-domains $CANARY_CD \
- --patterns-to-match '/docs' '/docs/*' \
- --supported-protocols Http Https --forwarding-protocol HttpsOnly \
- --https-redirect Enabled --link-to-default-domain Disabled
+# ---- Isolated UAMIs + single-SWA RBAC (for ADO WIF service connections) --
+az identity create --name otto-docs-canary-deploy-mi --resource-group otto-docs-canary-rg --location westus2
+az identity create --name otto-docs-prod-deploy-mi --resource-group otto-docs-rg --location westus2
+
+CANARY_MI_OID=$(az identity show --name otto-docs-canary-deploy-mi --resource-group otto-docs-canary-rg --query principalId -o tsv)
+PROD_MI_OID=$(az identity show --name otto-docs-prod-deploy-mi --resource-group otto-docs-rg --query principalId -o tsv)
+
+az role assignment create \
+ --assignee-object-id "$CANARY_MI_OID" --assignee-principal-type ServicePrincipal \
+ --role Contributor \
+ --scope "/subscriptions/$SUB/resourceGroups/otto-docs-canary-rg/providers/Microsoft.Web/staticSites/otto-docs-canary-swa"
+
+az role assignment create \
+ --assignee-object-id "$PROD_MI_OID" --assignee-principal-type ServicePrincipal \
+ --role Contributor \
+ --scope "/subscriptions/$SUB/resourceGroups/otto-docs-rg/providers/Microsoft.Web/staticSites/otto-docs-swa"
+
+# Bind Federated Identity Credentials from the ADO WIF service connections
+# (`otto-docs-canary-arm` and `otto-docs-prod-arm` in `msazure/One`) onto each UAMI:
+# az identity federated-credential create --name ado-otto-docs--arm \
+# --identity-name otto-docs--deploy-mi --resource-group \
+# --issuer --subject --audiences api://AzureADTokenExchange
```
-Repo-side one-time setup (GitHub UI — requires repo admin):
+ADO-side setup (`msazure/One`):
+
+1. Create pipeline `Logic-Apps-Automation-Docs` (definition `490778`) pointing at `.azure-pipelines/docs-site-deploy.yml` in `Azure/Logic-Apps-Automation`.
+2. Create WIF service connections `otto-docs-canary-arm` and `otto-docs-prod-arm` targeting each UAMI, authorized strictly for pipeline `490778` (`allPipelines: false`).
+3. Attach Exclusive Lock + Branch Control (`refs/heads/main,refs/tags/release`) to both connections, plus Manual Approval to `otto-docs-prod-arm`.
+
+### Zero-downtime Standard SKU bootstrap & rollback (Prod)
+
+Because the deploy pipeline refuses to deploy when `otto-docs-swa` is on `Free`
+SKU (so `forwardingGateway` is never silently ignored), upgrading a `Free` SWA
+whose currently deployed `staticwebapp.config.json` contains a stale
+`X-Azure-FDID` must follow a config-first sequence to avoid 403s on
+`https://auto.azure.com/docs/`:
+
+1. Build `docs-site` with the updated `apply-lockdown.mjs` (`fd12a176-4667-4e79-8d3d-0bd88e863ff7`) and deploy that bundle while `otto-docs-swa` is still `Free` (zero traffic impact while Free ignores `forwardingGateway`).
+2. Switch `otto-docs-swa` to `Standard` (`az staticwebapp update --name otto-docs-swa --resource-group otto-docs-rg --sku Standard`) — `forwardingGateway` immediately enforces the already-deployed `auto-portal-afd` FDID.
+3. Run an approved ADO `490778` (`target=prod`) deploy from `main` and verify `https://auto.azure.com/docs/` returns `200` and `https://kind-river-0d9e9ac1e.7.azurestaticapps.net/docs/` returns `403`.
+4. **Emergency rollback:** if AFD routing ever breaks after an FDID change, `az staticwebapp update --name otto-docs-swa --resource-group otto-docs-rg --sku Free` immediately disables `forwardingGateway` enforcement while the FDID is corrected.
+
+### Additional hardening notes
-1. **Settings → Secrets and variables → Actions → New repository secret**, add
- - `AZURE_CLIENT_ID = e8323013-aff3-46b9-8f7e-96ea41edf48a`
- - `AZURE_TENANT_ID = 72f988bf-86f1-41af-91ab-2d7cd011db47`
- - `AZURE_SUBSCRIPTION_ID = 49cff46c-0b82-4a1b-a533-ede69747bb0b`
-2. **Settings → Environments → New environment** named `docs-prod`,
- configure **Required reviewers** (recommended: 1+ team maintainer).
- Optionally restrict to `main`-only deploy branch.
+- **Branch protection & tag hygiene:** Both ADO service connections allow `refs/heads/main` and `refs/tags/release` (required by the 1ES `1ESPipelineTemplates` repository checkout). Protect `main` and restrict creation of a `release` tag in `Azure/Logic-Apps-Automation` so unreviewed commits cannot match `refs/tags/release`.
+- **Internal npm mirror:** Under 1ES `CFSClean` network isolation, `.azure-pipelines/ado.npmrc` authenticates via `npmAuthenticate@0` to `https://msazure.pkgs.visualstudio.com/_packaging/LogicApps/npm/registry/` (which upstreams `registry.npmjs.org`). Ensure the `msazure/One` Project Collection Build Service retains read permission on the `LogicApps` feed.
+- **Defense-in-depth networking:** `forwardingGateway` enforces `X-Azure-FDID` + `X-Forwarded-Host` at the SWA edge. Optionally restricting SWA `networking.allowedIpRanges` to the `AzureFrontDoor.Backend` service tag provides an additional network-layer barrier.
## Operational notes
@@ -294,8 +233,8 @@ Repo-side one-time setup (GitHub UI — requires repo admin):
- **Cache**: SWA serves cached static content from the edge; deploys roll
in atomically — no manual purge needed. AFD also caches static responses
per the route's compression / query-string-caching settings.
-- **Logs**: Deployment history is visible in the Azure Portal under each
- SWA's *Overview → Browse* tab. AFD access logs go to the profile's
- Diagnostic Settings (when enabled).
+- **Logs**: Deployment history is visible in Azure DevOps pipeline `490778`
+ and in the Azure Portal under each SWA's *Overview → Browse* tab. AFD access
+ logs go to the profile's Diagnostic Settings (when enabled).
- **Alerts**: Not configured. We can add an Application Insights availability
test (or simple AFD-side healthProbe) later if docs become production-critical.
diff --git a/docs-site/README.md b/docs-site/README.md
index d071292..d1a607c 100644
--- a/docs-site/README.md
+++ b/docs-site/README.md
@@ -5,7 +5,7 @@ Documentation for the workflow automation platform. This README is the entry poi
- 🌐 **Live (canary):** https://otto-canary.azure.com/docs/
- ⚙️ **Built with:** [Astro](https://astro.build) + [Starlight](https://starlight.astro.build) + [Plyr](https://plyr.io) (videos)
- ☁️ **Hosted on:** Azure Static Web App (canary subscription) — see [`INFRA.md`](./INFRA.md)
-- 🚀 **Deploy workflow:** [`.github/workflows/docs-site-deploy.yml`](../.github/workflows/docs-site-deploy.yml)
+- 🚀 **Build & Deploy:** PR validation in [`.github/workflows/docs-site-deploy.yml`](../.github/workflows/docs-site-deploy.yml); Canary & Prod deploys in [`.azure-pipelines/docs-site-deploy.yml`](../.azure-pipelines/docs-site-deploy.yml) (ADO pipeline `490778`)
---
@@ -517,10 +517,11 @@ hero: # only with template: splash
| Local build | `npm run build` |
| Local preview | `npm run preview` |
| CI validation | Pushes and PRs changing `docs-site/**` or the docs workflow run `npm run check`, `npm run build`, the checker unit tests, and `python3 scripts/validate_docs_site.py` |
-| Canary deploy | `push` to `main` under `docs-site/**` → SWA |
-| PR preview | In-repository PRs touching `docs-site/**` get a preview; fork PRs build only |
+| Canary deploy | `push` to `main` under `docs-site/**` → Azure DevOps pipeline `490778` → Canary SWA |
+| Prod deploy | Manual run of Azure DevOps pipeline `490778` (`target=prod`, `main` only, approval-gated) → Prod SWA |
-Workflow file: [`.github/workflows/docs-site-deploy.yml`](../.github/workflows/docs-site-deploy.yml).
+CI validation workflow: [`.github/workflows/docs-site-deploy.yml`](../.github/workflows/docs-site-deploy.yml).
+Deployment pipeline: [`.azure-pipelines/docs-site-deploy.yml`](../.azure-pipelines/docs-site-deploy.yml).
Resource map + rotation commands: [`INFRA.md`](./INFRA.md).
---
@@ -545,7 +546,7 @@ This section is a structured map for AI agents working on the docs.
| Embed a video on a page | Rename target page to `.mdx`; `import Video from '../../../components/Video.astro';` then ``. Auto-detects MP4 vs YouTube vs Vimeo and wraps Plyr lazily. |
| Update logo / favicon | `src/assets/logo.svg`, `public/favicon.svg` |
| Update SWA security headers / caching | `staticwebapp.config.json` |
-| Update deploy workflow | `../.github/workflows/docs-site-deploy.yml` |
+| Update build validation / deploy pipeline | `../.github/workflows/docs-site-deploy.yml` (PR checks) / `../.azure-pipelines/docs-site-deploy.yml` (ADO deploy) |
| Inspect canary infra / RBAC / fed creds | `INFRA.md` |
### Conventions checklist (every page must satisfy all of)
diff --git a/docs-site/scripts/apply-lockdown.mjs b/docs-site/scripts/apply-lockdown.mjs
old mode 100644
new mode 100755
index a8a47e9..5ad67bb
--- a/docs-site/scripts/apply-lockdown.mjs
+++ b/docs-site/scripts/apply-lockdown.mjs
@@ -22,8 +22,8 @@ const TARGETS = {
customDomain: 'otto-canary.azure.com',
},
prod: {
- // otto-portal-afd
- frontDoorId: 'c1504f11-9bfe-40e3-b58f-923f88dc0689',
+ // auto-portal-afd (RG: auto-portal-afd-rg)
+ frontDoorId: 'fd12a176-4667-4e79-8d3d-0bd88e863ff7',
customDomain: 'auto.azure.com',
},
};