Conversation
Auth errors (login_required, not_logged_in, azidentity AuthenticationFailedError)
were classified as 'unknown' in telemetry because they did not set
fields.ServiceName.String("aad"). This affected ~610K errors per 28 days.
Changes:
- Add ServiceName("aad") to ReLoginRequiredError branch in MapError()
- Move ErrNoCurrentUser handling from classifySentinel() into MapError()
so it can set errDetails with ServiceName("aad")
- Add handling for azidentity.AuthenticationFailedError with new result
code "auth.identity_failed" and ServiceName("aad")
- Update classifySuggestionType() to match MapError's handling
- Add test cases for ReLoginRequiredError and azidentity errors
- Update existing ErrNoCurrentUser tests to expect ServiceName("aad")
Fixes #7233
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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. |
Azure Dev CLI Install InstructionsInstall scriptsMacOS/Linux
bash: pwsh: WindowsPowerShell install MSI install Standalone Binary
MSI
Documentationlearn.microsoft.com documentationtitle: Azure Developer CLI reference
|
| } else if errors.Is(err, auth.ErrNoCurrentUser) { | ||
| errCode = "auth.not_logged_in" | ||
| errDetails = append(errDetails, fields.ServiceName.String("aad")) |
There was a problem hiding this comment.
I don't think we should be using aad as the serviceName. This error is locally generated and it could be coming from azd or az (when delegating auth).
Do we have something to classify that? local issues?
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.