Skip to content

Register the SQL Database Bicep samples so CI actually runs them - #125

Merged
paolosalvatori merged 2 commits into
mainfrom
feature/register-sql-database-bicep-samples
Sep 23, 2026
Merged

paolosalvatori merged 2 commits into
mainfrom
feature/register-sql-database-bicep-samples

Conversation

@paolosalvatori

@paolosalvatori paolosalvatori commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Both web-app-sql-database Bicep templates ship to users, and no CI job has ever deployed either of them:

  • samples/web-app-sql-database/python/bicep — commented out in BICEP_SAMPLES since the array was introduced in 046fd2ed (2026-02-25)
  • samples/web-app-sql-database/dotnet/bicep — never registered at all

The folders exist, the READMEs tell users to run them, and a broken template there would reach users with CI green. This is invisible rather than red, which is the part worth fixing.

Fixes SMF-909

Change

Register both, with the sample's shared validate.sh as the test command, matching the existing eventhubs Bicep entries.

validate.sh is deliberately shared across scripts, Bicep and Terraform — whichever way the resources were provisioned, the same assertions should hold. Registering Bicep with deploy-only would have been weaker than the check the sample already ships.

Verification

Run locally on a fresh emulator for each, since these are new shards:

DOCKER_FLAGS="-e MSSQL_ACCEPT_EULA=Y" bash run-samples.sh 50 67   # python/bicep
DOCKER_FLAGS="-e MSSQL_ACCEPT_EULA=Y" bash run-samples.sh 51 67   # dotnet/bicep

Both pass. Each deploys and then validates:

Resource Type
local-sqlserver-test Microsoft.Sql/servers
local-sqlserver-test/master, /PlannerDB Microsoft.Sql/servers/databases
local-app-service-plan-test Microsoft.Web/serverfarms
local-webapp-test Microsoft.Web/sites
local-kv-test + local-secret-test Microsoft.KeyVault/vaults (+ secret)

The .NET run additionally creates the testuser SQL login, grants it permissions, connects as that user, and deploys the app zip.

Whatever prompted the original comment no longer applies.

One pre-existing caveat, not introduced here

All four SQL flavours use the same Key Vault name, ${PREFIX}-kv-${SUFFIX} = local-kv-test. Running two of them back-to-back against the same emulator fails the second with:

ConflictError: A vault with the same name already exists in deleted state.

because Key Vault soft-delete outlives the resource-group cleanup between samples. This already applies to the registered scripts shards 13 and 14 — it is not something this PR creates. CI runs one shard per job against a fresh emulator, so it is unaffected; only a local full-suite run on one emulator hits it.

Worth fixing separately, either by giving each flavour a distinct vault name or by purging soft-deleted vaults in the harness cleanup. Happy to open a follow-up issue if useful.

🤖 Generated with Claude Code

https://claude.ai/code/session_01REQogJXRdeGF1rZm5edNTE

Both web-app-sql-database Bicep templates ship to users while no CI job
has ever deployed them. The python entry has been commented out since
BICEP_SAMPLES was introduced in 046fd2e (2026-02-25) and the dotnet
entry was never added at all, so a broken Bicep template in this sample
would reach users green.

Both deploy cleanly against the emulator today, so whatever prompted the
original comment no longer applies. Verified locally on a fresh emulator:

  DOCKER_FLAGS="-e MSSQL_ACCEPT_EULA=Y" bash run-samples.sh 50 67   # python
  DOCKER_FLAGS="-e MSSQL_ACCEPT_EULA=Y" bash run-samples.sh 51 67   # dotnet

Each provisions the SQL server, both databases, the app service plan, the
web app and the Key Vault with its secret, then passes the sample's shared
validate.sh.

Registered with `bash ../scripts/validate.sh` rather than deploy alone,
matching the eventhubs Bicep entries. validate.sh is deliberately shared
across all three provisioning methods, so a Bicep deployment that cannot
satisfy it is a finding rather than a reason to skip the check.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01REQogJXRdeGF1rZm5edNTE
@paolosalvatori
paolosalvatori requested a review from a team as a code owner September 22, 2026 10:59
Copilot AI lite review requested due to automatic review settings September 22, 2026 10:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Validation failures may not reliably propagate to CI.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 High severity

Open (1)
What changed in this PR

Registers the Python and .NET SQL Database Bicep samples so CI deploys and validates them.

Changes:

  • Adds both Bicep samples to the CI matrix.
  • Runs each sample’s shared validation script.
File Description
run-samples.sh Registers both SQL Database Bicep samples in CI.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread run-samples.sh

This branch was successfully deployed

1 active deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants