[typing] Add DefaultAzureCredential to allowed types for credentials in KeyVaultClient - #25144
Conversation
|
Thank you for your contribution soer7022! We will review the pull request and get back to you soon. |
|
Hi Søren Skov Eriksen (@soer7022), thank you for opening a PR and contributing to the SDK! In this instance though, I believe the current typing is correct. Key Vault clients (and other clients in the SDK) don't necessarily require Do you think the documentation should be more clear about that? And/or is there a type checker that raised an error when providing a DefaultAzureCredential to a Key Vault client? If so, that might be something we'd want to find a fix for. |
|
Søren Skov Eriksen (@soer7022) Thank you for providing context about the issue! That's the first time I've seen an IDE raise a concern with the typing, and suggests that there's something we can do to make the protocol implementation more clear to Python (and users). I can't reproduce the PyCharm warning on my end unfortunately -- I'm using a Python 3.10.0 interpreter on PyCharm Community Edition 2021.1.3. Could I know what interpreter and PyCharm version you're using? If you don't mind, I'd like to continue this discussion on #25175, an issue I opened to track this. It would be great if you could continue to help us to fix this! If not, that's no problem -- I appreciate that you brought this to our attention 🙂 I'm going to close this PR though, since the solution should come from the credential definition and/or the |
|
Thank you! I will add further details and comments on the issue |

Description
The current typing for KeyVaultClient does not match the steps described in current documentation: here
I have added the
DefaultAzureCredentialfromazure.identitybased on the current recommended steps from the documentation.All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines