[EDFI-2887] Add Azure SQL support to the windows-install scripts - #10
Open
analiliagutierrez wants to merge 3 commits into
Open
[EDFI-2887] Add Azure SQL support to the windows-install scripts#10analiliagutierrez wants to merge 3 commits into
analiliagutierrez wants to merge 3 commits into
Conversation
Allow the installer to target a managed Azure SQL Database while keeping local SQL Server installs unchanged. A non-loopback -SqlServerHost switches to remote mode: skip the local-instance setup (registry, TCP, service restart), provision a contained user as the SQL admin, and validate the server certificate. All new parameters default to the local path, so existing invocations are unaffected. Also set QUOTED_IDENTIFIER ON (sqlcmd -I) for the installer's OIDC/user DML on MSSQL, fixing the latent Msg 1934 against the filtered indexes.
- Retry the remote SQL admin connectivity check (6x, -l 30) so a serverless Azure SQL database resuming from auto-pause is not reported as unreachable, and add the serverless hint to the failure message. - Reject -SqlServerHost when -DbEngine is not 'mssql' (install-all and 05) instead of silently ignoring it.
analiliagutierrez
marked this pull request as ready for review
August 11, 2026 22:17
04-build.ps1 treated the front-end build as current based only on VITE_API_URL, so switching the identity provider (VITE_IDP_ACCOUNT_URL) or the base path (VITE_BASE_PATH) on the same API URL skipped the rebuild and left stale values baked into the bundle. Compare all three baked Vite values so a change to any of them triggers a rebuild.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for deploying the Admin App database on a managed Azure SQL Database to the
windows-installscripts. A non-loopback-SqlServerHostswitches the mssql path into remote mode: the local-instance setup is skipped, a contained database user is provisioned as a SQL admin and the server certificate is validated. All new parameters default to the local path, so existing local SQL Server installs are unchanged.What Changed
install-all.ps1/02-prereqs-sql.ps1/05-deploy-api.ps1/uninstall.ps1/00-check-prereqs.ps1:-SqlServerHost,-SqlServerPort,-SqlAdminUsername,-SqlAdminPassword,-TrustServerCertificate. A non-loopback host is the switch into remote mode.02-prereqs-sql.ps1: for a remote target, skip the local-instance steps (registry Mixed Mode/TCP, service restart) that have no Azure equivalent; verify SQL admin connectivity, then provision a contained user (CREATE USER ... WITH PASSWORD+db_owner) instead ofCREATE LOGIN+USE [db], since Azure SQL supports neither.05-deploy-api.ps1: setMSSQL_DB_HOST/MSSQL_DB_PORTfrom the parameters and defaultDB_TRUST_CERTIFICATEtofalsefor a remote target (Azure presents a valid CA certificate); use the resolved host in the encryption-key guard and OIDC reconcile.QUOTED_IDENTIFIER ON(sqlcmd -I) on the installer's MSSQL DML (OIDC reconcile, admin-user upsert), fixing a latentMsg 1934against the filtered indexes on[user]/[oidc].uninstall.ps1: a remote teardown path drops only the contained user (SQL admin auth) and leaves the managed database intact (operator-owned).00-check-prereqs.ps1: remote-aware — skips the local-instance checks (which would otherwise FAIL with no local SQL Server) and lists the Azure prerequisites.-AppDbPasswordthat contains the login name, which Azure rejects with an opaqueMsg 40632.-SqlServerHostwhen-DbEngineis notmssql(from the self-review) instead of silently ignoring it, ininstall-all.ps1and05-deploy-api.ps1.Architectural Decisions
05/00/install-all/uninstallplus duplicated helpers — more code, not less. Only02anduninstallcarry real branching.sqlcmd); the app self-migrates its schema on first boot, so no manual migration step is required.Testing
Automated
The
windows-installscripts have no unit-test harness in this repository. Validation: every changed script parses under Windows PowerShell 5.1 and PowerShell 7; and function-level tests of the new helpers (remote-target detection across localhost/(local)/IP/FQDN/named-pipe/machine-name; the password-vs-username check) pass in both editions.Manual
Local SQL Server regression (nothing broke):
uninstall.ps1 -Force→install-all.ps1 -IdpProvider keycloak(default local mssql).Azure SQL end-to-end:
sbaadatabase.install-all.ps1 -IdpProvider keycloak -SqlServerHost <server>.database.windows.net -SqlAdminUsername <admin> -SqlAdminPassword <...> -AppDbPassword <...> ...SQL admin connectivity confirmed→ contained user provisioned and verified →OIDC connection row reconciled→Admin user present with roleId=2→INSTALL COMPLETEwith the summary showing the managed server.SELECT name FROM [team]against the Azure DB).uninstall.ps1 -Force -SqlServerHost <...> -SqlAdminUsername <...> -SqlAdminPassword <...>→ drops only the contained user; the managed database is left intact.Error path: a remote target with no
-SqlAdminUsername, an unreachable database, or an-AppDbPasswordcontaining the login name each fail up front with an actionable message.Known Limitations / Follow-Up
Note: this branch also includes a small, separately-ticketed fix (EDFI-2893, commit 2a19ed9). 04-build.ps1 now compares VITE_API_URL, VITE_BASE_PATH, and VITE_IDP_ACCOUNT_URL when deciding whether the front-end bundle is current, so switching the identity provider or the base path on the same API URL no longer skips the rebuild (previously it baked stale values into the bundle). Touches only windows-install/04-build.ps1, with no overlap with the Azure SQL changes.
Checklist