Commit 8461f0a
[Identity] Add --no-prompt flag to AzureDeveloperCliCredential to prevent hanging with AZD_DEBUG (Azure#2914)
When the `AZD_DEBUG` environment variable is set, the `azd auth token`
subprocess hangs indefinitely waiting for user input:
```shell
$ AZD_DEBUG=1 azd auth token --output json --scope https://search.azure.com/.default
? Debugger Ready? (pid: 259503) (Y/n)
```
This causes `AzureDeveloperCliCredential.get_token()` to timeout when
debugging is enabled.
This PR adds the `--no-prompt` flag to the `azd auth token` command to
prevent interactive prompts and ensure the credential works reliably
regardless of debug settings.
**Changes:**
- Added `--no-prompt` to the azd command construction in `get_token()`
- Updated test assertions to verify the flag is included in generated
commands
**Example command before:**
```
azd auth token -o json --scope https://management.azure.com/.default
```
**Example command after:**
```
azd auth token -o json --no-prompt --scope https://management.azure.com/.default
```
All existing tests pass and the change is backward compatible.
Fixes Azure#2910.
<!-- START COPILOT CODING AGENT TIPS -->
---
💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: heaths <[email protected]>1 parent 2d7035a commit 8461f0a
File tree
1 file changed
+7
-4
lines changed- sdk/identity/azure_identity/src
1 file changed
+7
-4
lines changedLines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
174 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
175 | 176 | | |
176 | 177 | | |
177 | 178 | | |
178 | | - | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
179 | 182 | | |
180 | 183 | | |
181 | 184 | | |
| |||
0 commit comments