microsoft / microsoft/simplechat

Make AZD postprovision credential-aware and safely initialize settings and Search

Open
#1,489 0 comments 0 reactions 1 assignee View on GitHub

@paullizer is already working on this.

Since Sep 17, 2026.

bug P1 security_improvement
Dominant language
Python
Stars
152
Forks
116
Avg merge
7h 7m
Merged PRs (30d)
122

Description

Issue

AZD postprovision can fail on Cosmos accounts with local authentication disabled even when the runner has valid Entra data-plane access. The former key-only probe treated authentication failures as firewall propagation problems and could replace existing network rules with a runner-only rule.

Deployment-time settings writes also need to participate in the shared settings-store publication protocol, and fresh deployments require manual Search-index setup before document search can work.

Steps to Reproduce

  1. Deploy with managed_identity authentication against a Cosmos account with disableLocalAuth enabled.
  2. Run azd up or the postprovision hook from an authorized runner.
  3. Observe the key-based probe fail and the hook attempt an IP-rule update and propagation wait.
  4. In a Redis-enabled app, run the former postconfig writer while other workers update settings; its direct whole-document upsert bypasses coordinated shared-cache publication.
  5. On a deployment without Search indexes, use document search before manually creating the indexes in Admin Settings.

Expected Behavior

Use the selected deployment credential and environment; distinguish authentication and network errors without changing firewall policy. Publish intended settings changes with Cosmos concurrency checks and the existing shared Redis protocol. Create only missing Search indexes from the application schemas, preserving existing indexes and data.

Scope and Related Work

  • Cosmos database/container creation and schema drift remain tracked by #693 and #1471; this issue does not claim to solve them.
  • #1477 and merged PR #1478 established the runtime shared-settings protocol. This issue covers adopting that protocol in the deployment writer.
  • Implementation is in PR #1488, targeting Development, commit b9a063ab.
  • Versions: application 0.261.028; deployer 1.0.31.

Acceptance Criteria

  • Managed-identity Cosmos checks use the deployment runner's tenant-scoped Entra credential; key mode explicitly checks whether local auth is allowed.
  • Windows and POSIX postprovision never change Cosmos firewall rules or silently fall back from Entra to keys.
  • Hook lookups and role commands use the selected deployment environment/subscription, with actionable failures for missing required outputs.
  • Postconfig consolidates Redis assignments and uses the shared OCC/fenced publication store, preserving concurrent unrelated edits and external-cache settings.
  • Publication failures are not reported as success; active Redis connection migrations are refused rather than performed implicitly.
  • Missing personal/group/public Search indexes are created from app JSON schemas; existing indexes are untouched, and permission/service failures do not trigger creation.
  • Add offline behavioral tests for auth, environment selection, concurrency, publication failures, reruns, index races, and both platform hook paths.
  • Complete PR review and merge into Development.
  • Validate the new hook implementation in Azure using a runner with the documented Cosmos, Redis, and Search data-plane permissions.

Validation

  • 184 focused tests passed; 18 existing return-value warnings.
  • PowerShell/POSIX syntax and offline hook execution tests passed.
  • Broken-access-control, XSS, and whitespace checks passed.
  • Documentation quality: 6/6 passed. Surface coverage: 6/7; generated inventory mismatch also reproduced on unmodified Development and left out of scope.
  • No live cloud resources were changed during implementation/testing of this PR.

Operational Requirements

The runner needs approved network access and service data-plane permissions. Redis publication requires a suitable Redis database access policy; resource Owner alone is not sufficient. The change does not create policy exemptions, open firewalls, or enable local authentication. Active-cache migrations and existing Search schema upgrades remain administrator-managed.

Priority: P1. Assignee: @paullizer. Estimated size: M.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.