Ability to specify tenant_id#25207
Conversation
Updates the Azure CLI SDK To allow to create credential objects that are connected to tenants. This is EXTREMELY useful when you work with multiple tenants.
|
Thank you for your contribution tikicoder! We will review the pull request and get back to you soon. |
|
Hi @tikicoder, thank you for the PR and feedback! Some folks are out of office today, but we'll discuss your proposal and get back to you as soon as possible 🙂 |
Thanks |
|
Thank you for the contribution. Could you add the sync version too and also add some tests? Thank you. |
Ok that should be ready. |
xiangyan99
left a comment
There was a problem hiding this comment.
Test fails with error:
TypeError: resolve_tenant() got multiple values for keyword argument 'tenant_id'
Seems like we need:
if 'tenant_id' not in kwargs:
tenant = resolve_tenant(default_tenant= "", tenant_id= self.tenant_id, **kwargs)
else:
tenant = resolve_tenant(default_tenant= "", **kwargs)
Ok I updated it so instead of passing in default_tenant of empty it now passes something in. In theory, I would hope the tenant_id that is being passed in is None. I could update to include it in the logging but that seems overkill. Either this will work or it won't. It would make sense also that if you pass in a tenant_id on the class level it will become the default. |
xiangyan99
left a comment
There was a problem hiding this comment.
pylint error:
************* Module azure.identity.aio._credentials.azure_cli
azure/identity/aio/_credentials/azure_cli.py:63: [C0303(trailing-whitespace), ] Trailing whitespace
************* Module azure.identity._credentials.azure_cli
azure/identity/_credentials/azure_cli.py:75: [C0303(trailing-whitespace), ] Trailing whitespace
:)
|
That should be resolved now. I edited it in the github editor so looks like it added a tab that wasn't needed. |
Updates the Azure CLI SDK To allow to create credential objects that are connected to tenants. This is EXTREMELY useful when you work with multiple tenants.
Description
This allows developers to specify what tenant the credentials should use. This way if you have access to multiple you do not need to worry about switching other ways.
Testing Guidelines
I created the following wrapper class locally and it has fixed my issue. No reason I should have to be that hacky.