Account can't be found using (dotnet) code relying on Azure CLI credentials

Aperta
#1,190 3 commenti 0 reazioni 2 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@isra-fel ci sta già lavorando.

Dal 28/10/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

act-identity-squad
Affected surface

CLI (az)

Describe the bug

In our solution(s) we are relying on Managed Identities to connect with resources.
For our local environments, we use the Azure CLI identity for this and grant the engineers access to several of those resources.

The code, in csharp, looks pretty much like this:

var credential = new DefaultAzureCredential();

return new CosmosClient(
    accountEndpoint: accountEndpoint,
    tokenCredential: credential
);

I'm not sure on the internals of how this works, but it's safe to assume it relies on the az account module.
When running a command like

if az account show >/dev/null 2>&1; then echo 'Azure CLI has an active account'; else echo 'Azure CLI has no active account'; fi

It states no active account can't be found. Needless to say, I am logged in, but the az account isn't supported (yet?).

For me, this is blocking the usage of azclips at the moment, as I can't connect to our resources anymore.

I'm pretty sure this is probably somewhere on the roadmap, but I couldn't find it listed in the Issues yet.

Related command
az account show
Steps to reproduce
  1. az login --tenant-id --subscription-id -out-profile customer
  2. az account show // See an error occur
  3. Run this in the codebase
var credential = new DefaultAzureCredential();

return new CosmosClient(
    accountEndpoint: accountEndpoint,
    tokenCredential: credential
);
Errors & debug output
No real error, aside from the `account` module not existing.
Expected behavior

This to be on the roadmap, so we can use the logged in azclips identity to connect with Azure resources depending on actual identities.

Environment
az version
{
  "azCli": "0.1.6",
  "runtime": {
    "dotNet": ".NET 10.0.14",
    "os": "macOS 27.0.1",
    "architecture": "Arm64"
  }
}
Additional context

No response

Lingua principale
C#
Stelle
18
Fork
10
Merge medio
1g 20h
PR unite (30g)
157

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Azure/azclips

Tutte le issue di Azure/azclips

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.