Azure / Azure/azure-dev

Update `AzureDeveloperCLICredential` error message parsing in `azure-sdk-for-rust`

Open
#7,860 0 comments 0 reactions 1 assignee Claimed by @JeffreyCA View on GitHub
area/auth area/error-handling bug
Dominant language
Go
Stars
569
Forks
364
Avg merge
2d 19h
Merged PRs (30d)
136

Description

Tracked from: #7728

The azd auth error parsing improvements to `AzureDeveloperCLICredential` in `azure-sdk-for-rust` only support the older `consoleMessage` style JSON responses from `azd auth token --output json`. The parsing logic needs to be updated to handle all three formats across azd versions.

There are 3 different formats we may want to add parsing logic for:

**pre v1.23.7:**
```
{"type":"consoleMessage","timestamp":"2026-04-14T22:03:37.687535934Z","data":{"message":"\nERROR: fetching token: failed to authenticate:\n(invalid_tenant) AADSTS90002: Tenant 'test' not found...\n\n"}}
```

**v1.23.7 - v1.23.15:**
```
{"type":"consoleMessage","timestamp":"2026-04-13T17:43:24.7558297-07:00","data":{"message":"\n"}}
{"error":"fetching token: failed to authenticate:\n(invalid_tenant) AADSTS90002: Tenant 'test' not found...","links":[{"title":"azd auth login reference","url":"https://learn.microsoft.com/azure/developer/azure-developer-cli/reference#azd-auth-login"}],"message":"Authentication with Azure failed.","suggestion":"Run 'azd auth login' to sign in again."}
```

**v1.24.0 and newer:**
```
{"error":"fetching token: failed to authenticate:\n(invalid_tenant) AADSTS90002: Tenant 'test' not found...","links":[{"title":"azd auth login reference","url":"https://learn.microsoft.com/azure/developer/azure-developer-cli/reference#azd-auth-login"}],"message":"Authentication with Azure failed.","suggestion":"Run 'azd auth login' to sign in again."}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.