Azure / Azure/azure-rest-api-specs

TenantIdDescription returns nulls when using ClientSecretCredential

Open
#20,214 1 comment 0 reactions 0 assignees View on GitHub
AAD customer-reported question Service Attention
Dominant language
TypeSpec
Stars
3.1k
Forks
5.9k
Avg merge
2d 22h
Merged PRs (30d)
444

Description

I'm using ClientSecretCredential in Python to list the tenants, but it returns None. This seems to be related to https://github.com/Azure/azure-sdk-for-python/issues/22527

```
creds = ClientSecretCredential(tenant_id=tenant, client_id=client_id, client_secret=client_secret)
sclient = SubscriptionClient(credential=creds)
for tenant in sclient.tenants.list():
print(tenant)

{'additional_properties': {}, 'id': '/tenants/93XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXdb3', 'tenant_id': '93XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXdb3', 'tenant_category': 'Home', 'country': None, 'country_code': None, 'display_name': None, 'domains': None, 'default_domain': None, 'tenant_type': None, 'tenant_branding_logo_url': None}
```

Running it using `AzureCliCredential` with my credentials, it returns all the data.

Is this a permission issues? If so, what permission is needed? The app already has Reader privileges for the Subscription.

Thanks

```
$ pip freeze | grep azure
azure-common==1.1.28
azure-core==1.25.0
azure-identity==1.10.0
azure-mgmt-compute==27.2.0
azure-mgmt-core==1.3.2
azure-mgmt-network==21.0.0
azure-mgmt-resource==21.1.0
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing SubscriptionClient.tenants.list() with ClientSecretCredential and AzureCliCredential, then compare the returned tenant fields and review the linked issue. Determine whether the missing values are caused by permissions or the REST API response contract; the issue is done when the required permission or the needed specification correction is identified and documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, python
Domain
api, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.