docs(step-02): make Application Insights tracing keyless - #25
Merged
Conversation
The tracing section told participants that connecting Application Insights means the project emits telemetry "using a connection string — not an identity", contradicting the repo's keyless-auth-only rule. Foundry does support Entra-authenticated ingestion, so use it. - Connect with Auth type = Project Managed Identity (set before finishing the wizard, since it defaults to connection-string auth), plus the Edit authentication path for an existing key-based connection. - Grant Monitoring Metrics Publisher to BOTH writing identities: the project MI and the agent's instance identity. The agent identity is never granted automatically and is what fails after azd deploy with "The Agent/SDK does not have permissions to send telemetry". - Disable local auth only after both grants have landed, with a dedicated-resource warning (it is resource-wide) and a rollback. - Guard every scope-taking command. `az role assignment create --scope ""` does not fail, it silently falls back to subscription scope, so a participant running a later block in a fresh shell would have granted these roles subscription-wide. - Expand the required-permissions note, fix the renumbered cross-refs, and correct the hosted-agent-permissions reference description. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 754171bf-7b59-4870-b062-884cb7f4fd4b
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.
Why
Step 2's optional tracing section told participants that connecting Application Insights means the project emits telemetry "using a connection string — not an identity — so emitting traces needs no role assignment."
That contradicts this repo's Zero Trust rule ("No passwords, no keys, no secrets"). Foundry does support Entra-authenticated trace ingestion, so the workshop should teach the keyless path like every other resource.
This also fixes a real failure Pierre Malarme (@pmalarme) hit on a deployed agent:
What changed
Docs only — one file,
.workshop/docs/steps/02-tools.md. No code, no manifest,resources: []is untouched.The section is renumbered 1–4 → 1–5:
Monitoring Metrics Publisherto the project MI on create, but the agent's instance identity never gets it automatically — that's theThe Agent/SDK does not have permissionserror above. Local auth is disabled only after both grants land.Monitoring Reader(unchanged).Log Analytics Readerat both scopes for evaluations (unchanged).Forbiddencase.Security fix found in review
az role assignment create --scope ""does not fail — it silently falls back to subscription scope (_build_role_scope: falsy scope →scope = subscription_scope).The first draft declared
$APP_INSIGHTSin one fenced block and reused it in four others. A participant running any later block in a fresh shell would have grantedMonitoring Metrics PublisherandMonitoring Readersubscription-wide — the opposite of least privilege. Every scope-taking block now fail-fast guards (${VAR:?...}/if (-not $env:VAR) { throw }), verified in real bash and PowerShell.Also from review: portal step ordering, a resource-wide blast-radius warning + rollback for
DisableLocalAuth, expanded required-permissions (connections/write— Foundry User alone can't create the connection), and a corrected reference description (the hosted-agent-permissions doc's observability section is about human viewing; it does not list "Log Analytics Data Reader for the project identity").Validation
python .workshop/scripts/lint_steps.py→ 0 failures (2 pre-existing unrelated warnings)python -m pytest .workshop/scripts/tests→ 154 passedrender_readme.py --step 2inspected; guards and the#run-and-deploy-travelbuddyanchor render correctly.workshop/solutions/02-tools/or.workshop/step_files/02/update needed (portal/CLI setup only, no code)Confirmed working end-to-end by Pierre Malarme (@pmalarme) on a live deployment.
Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com