TokenCloudCredentials no longer valid - what to use?
See original GitHub issueTeam - recently updated to the latest modules, and was disappointed to find that apparently the Credentials that used to work mostly universally now don’t. I’m working with the KeyVault data plane modules, and used to pass a TokenCloudCredentials instance to KeyVaultClient. However, now I’m getting the following error:
Error: credentials must be one of: ApplicationTokenCredentials, UserTokenCredentials, DeviceTokenCredentials, MSITokenCredentials
This is fine, but none of the docs I can find reflect this change, or how to deal with it (Note that TokenCloudCredentials still works with the ARM management plane).
So a few issues:
- If this changed, can the docs reflect it?
- What is the correct pattern now for using KeyVaultClient, and is it uniform across the SDK modules?
- Lots of references to ms-rest / ms-rest-azure, but I can’t find doc’s on these either…resorting to looking through source. Are there missing doc’s somewhere?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Forbidden with TokenCloudCredentials - Stack Overflow
ForbiddenError: The server failed to authenticate the request. Verify that the certificate is valid and is associated with this subscription.
Read more >Access Token seems to be invalid - MSDN - Microsoft
i am trying to use Microsoft.Azure.Management.Resources library to manage some Azure resources. I have registered app in Azure AD and i gave ...
Read more >Introducing the Microsoft Azure Management Libraries
With this release, REST management libraries are now available for a majority of today's Azure services. The libraries are straightforward, easy ...
Read more >Microsoft.Azure.Common.xml 1.0.5 - PowerShell Gallery
Initializes a new instance of the <see cref="T:Microsoft.Azure.TokenCloudCredentials"/> class without subscription ID. </summary> <param name="token">Valid ...
Read more >Processing Big Data with Azure HDInsight Building Real-World Big ...
To view all available resource group names, use the "azure group list" command. ... cluster is no longer required, you can delete it...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Its a result of this code: https://github.com/Azure/azure-sdk-for-node/blob/master/runtime/ms-rest-azure/lib/credentials/keyVaultCredentials.js#L35-L64
For some context, keyvault used to require users to define their own authentification callback. The change was done to abstract that away from developers and allow them to simply use the returned credentials from a login. Unfortunately, we only took care of the four types of credentials listed in the error.
I’m not familiar with the TokenCloudCredentials type but a solution could be to expand the list of accepted creds. Docs still only retain the old flow: https://github.com/Azure/azure-sdk-for-node/blob/master/lib/services/keyVault/README.md#authentication
Here’s a sample utilizing the newer method: https://github.com/Azure-Samples/key-vault-node-deploy-certificates-to-vm/blob/master/index.js#L61-L67
Agreed - very helpful. That said, what we need to get front and center are the concepts / patterns used throughout the SDK (as you pointed out). No small feat for sure, but that’s the secret sauce to a great dev experience.
Appreciate the insights!