Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 17 additions & 23 deletions .github/workflows/deploy.reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,12 @@ concurrency:

jobs:
deploy:
# windows-latest, not ubuntu-latest: `pac auth create`'s SP profile
# (secret included) persists via Windows Credential Manager (DPAPI) here,
# which just works. On Linux runners it falls back to an unprotected
# plaintext cache (no keyring daemon available even with libsecret
# installed) that a later step's `pac code push` process fails to reload
# correctly -- surfaces as AADSTS7000215 "Invalid client secret provided"
# even though the same secret authenticates fine elsewhere in the same
# job (e.g. the import-solution action, which doesn't round-trip through
# this cache). Found live 2026-07-02; libsecret-1-0 alone didn't fix it
# (confirmed: still no working keyring service headlessly).
# windows-latest was chosen on 2026-07-02 because `pac auth create`'s
# service-principal profile could not be reloaded on Linux runners by a
# later `pac code push`. The app is now published with the npm-based
# Power Apps CLI and no `pac auth` profile (see scripts/deploy/deploy-app.ps1),
# so that reason is gone; the runner is kept because every other step is
# verified on it and a Linux runner has not been tried with the new CLI.
runs-on: windows-latest
environment: ${{ inputs.environment }}
permissions:
Expand Down Expand Up @@ -120,19 +116,13 @@ jobs:
PP_ENVIRONMENT_URL: ${{ vars.PP_ENVIRONMENT_URL }}
run: ./scripts/deploy/configure-reminder-flow.ps1

# --- App (US2, FR-005): pac code push and pac data import (below) use
# the pac CLI directly, so authenticate immediately before them here
# rather than earlier — a profile created before the actions above ran
# is not reliably present afterward.
- name: Authenticate to Power Platform
shell: pwsh
env:
PP_CLIENT_ID: ${{ secrets.PP_CLIENT_ID }}
PP_CLIENT_SECRET: ${{ secrets.PP_CLIENT_SECRET }}
PP_TENANT_ID: ${{ secrets.PP_TENANT_ID }}
PP_ENVIRONMENT_URL: ${{ vars.PP_ENVIRONMENT_URL }}
run: ./scripts/deploy/auth.ps1

# --- App (US2, FR-005): published with the npm-based Power Apps CLI
# (`pa app push --non-interactive`), signed in as the service principal
# through environment variables -- Microsoft's supported path, per the
# resolution of microsoft/PowerAppsCodeApps#394. No `pac auth` profile
# is involved. One-time prerequisite, done by the app's owner: the app
# is shared with the service principal with edit access (see
# scripts/deploy/deploy-app.ps1).
- name: Render power.config.json
shell: pwsh
env:
Expand All @@ -142,6 +132,10 @@ jobs:

- name: Deploy Code App
shell: pwsh
env:
PP_CLIENT_ID: ${{ secrets.PP_CLIENT_ID }}
PP_CLIENT_SECRET: ${{ secrets.PP_CLIENT_SECRET }}
PP_TENANT_ID: ${{ secrets.PP_TENANT_ID }}
run: ./scripts/deploy/deploy-app.ps1

# --- Data (US3, FR-016): off by default, opt-in only, no record-content logging ---
Expand Down
44 changes: 19 additions & 25 deletions .github/workflows/promote-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,14 @@ jobs:

deploy-production:
needs: sync-dev-and-export
# windows-latest, not ubuntu-latest: `pac auth create`'s SP profile
# (secret included) persists via Windows Credential Manager (DPAPI) here,
# which just works. On Linux runners it falls back to an unprotected
# plaintext cache (no keyring daemon available even with libsecret
# installed) that a later step's `pac code push` process fails to reload
# correctly -- surfaces as AADSTS7000215 "Invalid client secret provided"
# even though the same secret authenticates fine elsewhere in the same
# job (e.g. the import-solution action, which doesn't round-trip through
# this cache). Found live 2026-07-02; libsecret-1-0 alone didn't fix it
# (confirmed: still no working keyring service headlessly). The
# sync-dev-and-export job above stays on ubuntu-latest -- it only uses
# official actions with their own direct auth, never a persisted profile.
# windows-latest was chosen on 2026-07-02 because `pac auth create`'s
# service-principal profile could not be reloaded on Linux runners by a
# later `pac code push`. The app is now published with the npm-based
# Power Apps CLI and no `pac auth` profile (see scripts/deploy/deploy-app.ps1),
# so that reason is gone; the runner is kept because every other step is
# verified on it and a Linux runner has not been tried with the new CLI.
# The sync-dev-and-export job above stays on ubuntu-latest -- it only
# uses official actions with their own direct auth.
runs-on: windows-latest
environment: production
permissions:
Expand Down Expand Up @@ -197,19 +193,13 @@ jobs:
PP_ENVIRONMENT_URL: ${{ vars.PP_ENVIRONMENT_URL }}
run: ./scripts/deploy/configure-reminder-flow.ps1

# --- App (US2, FR-005): pac code push and pac data import (below) use
# the pac CLI directly, so authenticate immediately before them here
# rather than earlier — a profile created before the actions above ran
# is not reliably present afterward.
- name: Authenticate to Power Platform
shell: pwsh
env:
PP_CLIENT_ID: ${{ secrets.PP_CLIENT_ID }}
PP_CLIENT_SECRET: ${{ secrets.PP_CLIENT_SECRET }}
PP_TENANT_ID: ${{ secrets.PP_TENANT_ID }}
PP_ENVIRONMENT_URL: ${{ vars.PP_ENVIRONMENT_URL }}
run: ./scripts/deploy/auth.ps1

# --- App (US2, FR-005): published with the npm-based Power Apps CLI
# (`pa app push --non-interactive`), signed in as the service principal
# through environment variables -- Microsoft's supported path, per the
# resolution of microsoft/PowerAppsCodeApps#394. No `pac auth` profile
# is involved. One-time prerequisite, done by the app's owner: the app
# is shared with the service principal with edit access (see
# scripts/deploy/deploy-app.ps1).
- name: Render power.config.json
shell: pwsh
env:
Expand All @@ -219,6 +209,10 @@ jobs:

- name: Deploy Code App
shell: pwsh
env:
PP_CLIENT_ID: ${{ secrets.PP_CLIENT_ID }}
PP_CLIENT_SECRET: ${{ secrets.PP_CLIENT_SECRET }}
PP_TENANT_ID: ${{ secrets.PP_TENANT_ID }}
run: ./scripts/deploy/deploy-app.ps1

# --- Data (US3, FR-016): off by default, opt-in only, no record-content logging ---
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ Manual promotion
No code reaches production without a human sign-off.
```

The app is published by the deployment service principal with the Power Apps CLI (`pa app push --non-interactive`), the path Microsoft documents for service principals. One-time setup per environment: the app's owner shares the app with that environment's service principal, with edit access. From a folder whose `power.config.json` points at that environment's app:

```bash
npx pa auth login
npx pa app share --principal <enterprise-application-object-id> --access edit
```

Use the object ID shown under **Enterprise applications** in Microsoft Entra, not the one under App registrations.

### Security posture

- **[Gitleaks](https://github.com/gitleaks/gitleaks)** runs on every PR — any committed secret blocks the merge
Expand Down
88 changes: 58 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"devDependencies": {
"@eslint/js": "^9.36.0",
"@microsoft/power-apps": "^1.1.3",
"@microsoft/power-apps-cli": "1.2.0",
"@microsoft/power-apps-vite": "^1.0.2",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.2",
Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/render-power-config.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Renders power.config.json from power.config.template.json by substituting the
__ENVIRONMENT_ID__ / __APP_ID__ placeholders with values from the
PP_ENVIRONMENT_ID / PP_APP_ID environment variables. Run this immediately
before `pac code push` in a deploy job.
before the Code App is published in a deploy job (scripts/deploy/deploy-app.ps1).
#>

$ErrorActionPreference = 'Stop'
Expand Down
54 changes: 0 additions & 54 deletions scripts/deploy/auth.ps1

This file was deleted.

Loading
Loading