Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sdk/identity/Azure.Identity/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### Bugs Fixed

- Fixed `AzureDeveloperCliCredential` hanging when the `AZD_DEBUG` environment variable is set by adding the `--no-prompt` flag to prevent interactive prompts ([#52005](https://github.com/Azure/azure-sdk-for-net/issues/52005)).

### Other Changes

## 1.15.0 (2025-08-11)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ private static void GetFileNameAndArguments(string[] scopes, string tenantId, ou
string scopeArgs = string.Join(" ", scopes.Select(scope => $"--scope {scope}"));
string command = tenantId switch
{
null => $"azd auth token --output json {scopeArgs}",
_ => $"azd auth token --output json {scopeArgs} --tenant-id {tenantId}"
null => $"azd auth token --output json --no-prompt {scopeArgs}",
_ => $"azd auth token --output json --no-prompt {scopeArgs} --tenant-id {tenantId}"
};

if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,22 @@ public async Task AuthenticateWithDeveloperCliCredential(
}
}

[Test]
public async Task AuthenticateWithDeveloperCliCredential_IncludesNoPromptFlag()
{
var context = new TokenRequestContext(new[] { Scope });
var (expectedToken, expectedExpiresOn, processOutput) = CredentialTestHelpers.CreateTokenForAzureDeveloperCli();

var testProcess = new TestProcess { Output = processOutput };
AzureDeveloperCliCredential credential =
InstrumentClient(new AzureDeveloperCliCredential(CredentialPipeline.GetInstance(null), new TestProcessService(testProcess, true)));
AccessToken actualToken = await credential.GetTokenAsync(context);

Assert.AreEqual(expectedToken, actualToken.Token);
Assert.AreEqual(expectedExpiresOn, actualToken.ExpiresOn);
Assert.That(testProcess.StartInfo.Arguments, Does.Contain("--no-prompt"));
}

[Test]
public void AuthenticateWithCliCredential_InvalidJsonOutput(
[Values("", "{}", "{\"Some\": false}", "{\"token\": \"token\"}", "{\"expiresOn\" : \"1900-01-01T00:00:00Z\"}")]
Expand Down