Conversation
There was a problem hiding this comment.
Pull request overview
Improves telemetry classification for auth-related failures by ensuring these errors set service.name = "aad" so downstream category bucketing no longer falls back to "unknown".
Changes:
- Add
service.name="aad"details forauth.ReLoginRequiredError(auth.login_required). - Move
auth.ErrNoCurrentUserclassification intoMapErrorand setservice.name="aad"(auth.not_logged_in). - Add explicit handling for
azidentity.AuthenticationFailedErrorwith new codeauth.identity_failedandservice.name="aad", and keepclassifySuggestionTypealigned.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| cli/azd/internal/cmd/errors.go | Updates error-to-telemetry mapping to tag key auth errors with service.name="aad" and adds a dedicated azidentity auth-failure code. |
| cli/azd/internal/cmd/errors_test.go | Adds/updates test cases to validate new auth mappings and ensure classifySuggestionType stays in sync with MapError. |
|
Great catch @JeffreyCA — you're right that Here's the corrected approach:
I'll update the PR to use |
0dbeb39 to
b9f0d7b
Compare
b9f0d7b to
66c6931
Compare
Auth errors were classified as 'unknown' in telemetry (~610K/28d).
Changes:
- Add ErrCategory("auth") to ReLoginRequiredError, ErrNoCurrentUser,
and azidentity.AuthenticationFailedError branches in MapError()
- Move ErrNoCurrentUser from classifySentinel() into MapError() so
it can set errDetails
- Add azidentity.AuthenticationFailedError handler with new code
"auth.identity_failed"
- Update classifySuggestionType() to match
Per @JeffreyCA and @vhvb1989 feedback: use error.category (not
service.name) for all auth errors since these are locally generated
and may come from azd or az CLI delegated auth, not from AAD directly.
Fixes #7233
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
66c6931 to
642099a
Compare
Add lessons learned from recent PR reviews (#7290, #7251, #7250, #7247, #7236, #7235, #7202, #7039) as agent instructions to prevent recurring review findings. New sections: - Error handling: ErrorWithSuggestion completeness, telemetry service attribution, scope-agnostic messages - Architecture boundaries: pkg/project target-agnostic, extension docs - Output formatting: shell-safe paths, consistent JSON contracts - Path safety: traversal validation, quoted paths in messages - Testing best practices: test actual rules, extract shared helpers, correct env vars, TypeScript patterns, efficient dir checks - CI/GitHub Actions: permissions, PATH handling, artifact downloads, prefer ADO for secrets Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add lessons learned from team and Copilot reviews across PRs #7290, #7251, #7250, #7247, #7236, #7235, #7202, #7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
Add lessons learned from team and Copilot reviews across PRs #7290, #7251, #7250, #7247, #7236, #7235, #7202, #7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add lessons learned from team and Copilot reviews across PRs #7290, #7251, #7250, #7247, #7236, #7235, #7202, #7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add lessons learned from team and Copilot reviews across PRs #7290, #7251, #7250, #7247, #7236, #7235, #7202, #7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add lessons learned from team and Copilot reviews across PRs #7290, #7251, #7250, #7247, #7236, #7235, #7202, #7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add lessons learned from team and Copilot reviews across PRs #7290, #7251, #7250, #7247, #7236, #7235, #7202, #7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* docs: add PR review patterns to AGENTS.md Add lessons learned from team and Copilot reviews across PRs #7290, #7251, #7250, #7247, #7236, #7235, #7202, #7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Copilot instructions for code review and strengthen guidance on Go patterns (#7320) * Fix Copilot instructions for code review and strengthen guidance on Go patterns * Update wording --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: JeffreyCA <jeffreychen@microsoft.com>
Auth errors were classified as 'unknown' in telemetry (~610K/28d).
Changes:
- Add ErrCategory("auth") to ReLoginRequiredError, ErrNoCurrentUser,
and azidentity.AuthenticationFailedError branches in MapError()
- Move ErrNoCurrentUser from classifySentinel() into MapError() so
it can set errDetails
- Add azidentity.AuthenticationFailedError handler with new code
"auth.identity_failed"
- Update classifySuggestionType() to match
Per @JeffreyCA and @vhvb1989 feedback: use error.category (not
service.name) for all auth errors since these are locally generated
and may come from azd or az CLI delegated auth, not from AAD directly.
Fixes Azure#7233
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* docs: add PR review patterns to AGENTS.md Add lessons learned from team and Copilot reviews across PRs Azure#7290, Azure#7251, Azure#7250, Azure#7247, Azure#7236, Azure#7235, Azure#7202, Azure#7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Copilot instructions for code review and strengthen guidance on Go patterns (Azure#7320) * Fix Copilot instructions for code review and strengthen guidance on Go patterns * Update wording --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: JeffreyCA <jeffreychen@microsoft.com>
Auth errors were classified as 'unknown' in telemetry (~610K/28d).
Changes:
- Add ErrCategory("auth") to ReLoginRequiredError, ErrNoCurrentUser,
and azidentity.AuthenticationFailedError branches in MapError()
- Move ErrNoCurrentUser from classifySentinel() into MapError() so
it can set errDetails
- Add azidentity.AuthenticationFailedError handler with new code
"auth.identity_failed"
- Update classifySuggestionType() to match
Per @JeffreyCA and @vhvb1989 feedback: use error.category (not
service.name) for all auth errors since these are locally generated
and may come from azd or az CLI delegated auth, not from AAD directly.
Fixes Azure#7233
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* docs: add PR review patterns to AGENTS.md Add lessons learned from team and Copilot reviews across PRs Azure#7290, Azure#7251, Azure#7250, Azure#7247, Azure#7236, Azure#7235, Azure#7202, Azure#7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Copilot instructions for code review and strengthen guidance on Go patterns (Azure#7320) * Fix Copilot instructions for code review and strengthen guidance on Go patterns * Update wording --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: JeffreyCA <jeffreychen@microsoft.com>
Auth errors were classified as 'unknown' in telemetry (~610K/28d).
Changes:
- Add ErrCategory("auth") to ReLoginRequiredError, ErrNoCurrentUser,
and azidentity.AuthenticationFailedError branches in MapError()
- Move ErrNoCurrentUser from classifySentinel() into MapError() so
it can set errDetails
- Add azidentity.AuthenticationFailedError handler with new code
"auth.identity_failed"
- Update classifySuggestionType() to match
Per @JeffreyCA and @vhvb1989 feedback: use error.category (not
service.name) for all auth errors since these are locally generated
and may come from azd or az CLI delegated auth, not from AAD directly.
Fixes Azure#7233
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* docs: add PR review patterns to AGENTS.md Add lessons learned from team and Copilot reviews across PRs Azure#7290, Azure#7251, Azure#7250, Azure#7247, Azure#7236, Azure#7235, Azure#7202, Azure#7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Copilot instructions for code review and strengthen guidance on Go patterns (Azure#7320) * Fix Copilot instructions for code review and strengthen guidance on Go patterns * Update wording --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: JeffreyCA <jeffreychen@microsoft.com>
Auth errors were classified as 'unknown' in telemetry (~610K/28d).
Changes:
- Add ErrCategory("auth") to ReLoginRequiredError, ErrNoCurrentUser,
and azidentity.AuthenticationFailedError branches in MapError()
- Move ErrNoCurrentUser from classifySentinel() into MapError() so
it can set errDetails
- Add azidentity.AuthenticationFailedError handler with new code
"auth.identity_failed"
- Update classifySuggestionType() to match
Per @JeffreyCA and @vhvb1989 feedback: use error.category (not
service.name) for all auth errors since these are locally generated
and may come from azd or az CLI delegated auth, not from AAD directly.
Fixes Azure#7233
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* docs: add PR review patterns to AGENTS.md Add lessons learned from team and Copilot reviews across PRs Azure#7290, Azure#7251, Azure#7250, Azure#7247, Azure#7236, Azure#7235, Azure#7202, Azure#7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Copilot instructions for code review and strengthen guidance on Go patterns (Azure#7320) * Fix Copilot instructions for code review and strengthen guidance on Go patterns * Update wording --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: JeffreyCA <jeffreychen@microsoft.com>
Auth errors were classified as 'unknown' in telemetry (~610K/28d).
Changes:
- Add ErrCategory("auth") to ReLoginRequiredError, ErrNoCurrentUser,
and azidentity.AuthenticationFailedError branches in MapError()
- Move ErrNoCurrentUser from classifySentinel() into MapError() so
it can set errDetails
- Add azidentity.AuthenticationFailedError handler with new code
"auth.identity_failed"
- Update classifySuggestionType() to match
Per @JeffreyCA and @vhvb1989 feedback: use error.category (not
service.name) for all auth errors since these are locally generated
and may come from azd or az CLI delegated auth, not from AAD directly.
Fixes Azure#7233
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* docs: add PR review patterns to AGENTS.md Add lessons learned from team and Copilot reviews across PRs Azure#7290, Azure#7251, Azure#7250, Azure#7247, Azure#7236, Azure#7235, Azure#7202, Azure#7039 as agent instructions to prevent recurring review findings. New/expanded sections: - Error handling: ErrorWithSuggestion field completeness, telemetry service attribution, scope-agnostic messages, link/suggestion parity, stale data in polling loops - Architecture boundaries: pkg/project target-agnostic, extension docs separation, env var verification against source code - Output formatting: shell-safe quoted paths, consistent JSON types - Path safety: traversal validation, quoted paths in messages - Code organization: extract shared logic across scopes - Documentation standards: help text consistency, no dead references, PR description accuracy - Testing best practices: test YAML rules e2e, extract shared helpers, correct env vars (AZD_FORCE_TTY, NO_COLOR), TypeScript patterns, reasonable timeouts, cross-platform paths, test new JSON fields - CI / GitHub Actions: permissions blocks, PATH handling, cross-workflow artifacts, prefer ADO for secrets, no placeholder steps Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix Copilot instructions for code review and strengthen guidance on Go patterns (Azure#7320) * Fix Copilot instructions for code review and strengthen guidance on Go patterns * Update wording --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: JeffreyCA <jeffreychen@microsoft.com>
- Add CHANGELOG entry for azd 1.23.13 (2026-03-26) including features, bug fixes, and other changes from PRs Azure#7247, Azure#7236, Azure#7329, Azure#7346, Azure#7311, Azure#7250, Azure#7235, and Azure#7330. - Document AZD_EXT_TIMEOUT environment variable in environment-variables.md. This variable was introduced in PR Azure#7346 (fix: use 127.0.0.1 for gRPC server address and increase extension timeout) but was not previously documented for users. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Summary
Fixes #7233
Auth errors (
login_required,not_logged_in,azidentity.AuthenticationFailedError) were classified as"unknown"in telemetry because they did not setfields.ServiceName.String("aad"). This affected ~610K errors per 28 days and made the"unknown"error category bucket unreliable for analysis.Changes
ReLoginRequiredError→auth.login_requiredaadErrNoCurrentUser→auth.not_logged_inclassifySentinel)aad(moved toMapErrorif-else chain)azidentity.AuthenticationFailedErrorinternal.*catch-allauth.identity_failedwith ServiceNameaadCode
errors.go: AddedServiceName("aad")toReLoginRequiredErrorbranch, movedErrNoCurrentUserout ofclassifySentinel()intoMapError(), addedazidentity.AuthenticationFailedErrorhandler, updatedclassifySuggestionType()to stay in sync.errors_test.go: Added test cases forReLoginRequiredErrorandazidentity.AuthenticationFailedError, updatedErrNoCurrentUsertests to expectServiceName("aad"), added entries toClassifySuggestionType_MatchesMapError.Expected Telemetry Impact
After this fix, the Kusto
AzdErrorCategorycolumn will show:auth.login_requiredunknown❌aad✅auth.not_logged_inunknown❌aad✅auth.identity_failed(wasinternal.azidentity_*)unknown❌aad✅service.aad.failedaad✅aad✅ (unchanged)This removes ~610K errors/28d from the
"unknown"bucket.