Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.63k stars 5.06k forks source link

TenantIdDescription returns nulls when using ClientSecretCredential #20214

Open mdhowle opened 2 years ago

mdhowle commented 2 years ago

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
mdhowle commented 1 year ago

Azure Support has determined the ClientSecretCredential does not have a PUID the underlying API that dispenses Tenant information requires. I have posted in the feedback "ideas" as a long shot to get this resolved.

https://feedback.azure.com/d365community/idea/4a47fd48-5493-ed11-a81b-000d3ae5ae95