-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[QUERY]Getting TokenCredentials to connect to azure resources for Desktop Applications #25066
Comments
Thank you for your feedback. Tagging and routing to the team members best able to assist. |
Hi @ShrutiJaiswal1494 - One clarification: Are you intending to connect to the storage account using a specific that you own identity rather than the identity of the user of the application? Because this is a desktop environment, I don't think there would be a way to protect your credential, no matter how it is acquired. Have you considered using a SAS token instead? This would allow you to delegate constrained and timeboxed access to users of the desktop app. |
Hey @christothes, Thanks for the reply. My application will be Microsoft internal. So I want everyone with Microsoft account to have access but I am not sure how to do it. For your suggestion of SAS token, I am already using a SAS with user delegation key to time-bound the access. |
Your choices are essentially to build the service client for a single user (some credential you own) or for the user that is running the application (DefaultAzureCredential or specific local credential such as AzureCliCredential). If you build it for the user running the app, you'd just need to decide how to assign roles to an AAD security group that your users would be a member of. With SAS, you could do something like create a web service that issues SAS tokens to your client application. |
|
There isn't a great way that doesn't compromise the credential, since it is a desktop app.
You can't - that is a pre-requisite that you could handle in your app's error messages.
Correct. |
|
@ShrutiJaiswal1494 if your intent is to authenticate users in your app as you are doing directly with msal in the link you gave here. I would suggest using the InteractiveBrowserCredential, as it is the closest analogue to how you are authenticating with the Also, if you wish to persist tokens across app executions you can enable this by using the |
If you would rather continue using MSAL's |
Thanks for the reply @schaabs. I am thinking to use the InteractiveBrowserCredential approach to authenticate the users however I had some doubts. Since I want the blob storage to be accessed by everyone in Microsoft, will I need to give access to each and every MS employee to my blob storage? If yes, then is there a security group or something that I can give access to? |
Hi All,
I am working on a .Net Core Desktop Application that needs to connect to Azure Blob Storage to download some files. To authenticate the requests to storage we need a token to be given during the blob service client creation and I am not sure what’s the correct way to get this token credential.
Using DefaultAzureCredential
Reading the documentation here it seems there is an option to use DefaultAzureCredential that looks for credentials in multiple places.. It is working fine for my local dev environment as it's getting the credential from VS Code/Azure CLI. But for prod, I assume that this approach is for applications running in Azure. However, my application is a desktop application. Can I still use this to acquire
TokenCredential
in the prod environment as well or is there anything else I need to set up to make sure it works fine for other users when distributed as a packaged application (I want to avoid user interaction as much as possible)?Using ClientSecretCredential
Another approach to get the credentials is to use the ClientSecretCredential class by passing the teantId, clientId, and clientSecret for the registered App. Since clientSecret should not be stored in the source code, how can I get this value in my application? I thought of using a
KeyVault
for this but again the issue is how to get theTokenCredentials
to connect toKeyVault
?or is there any other approach that I can use to get the
TokenCredential
to connect to Azure?P.S: I am using Microsoft.Identity.Client to authenticate users with Microsoft account following the example here . Is there a way I can use the AccessToken retrieved here to get a
TokenCredential
for blob client?code for reference
Any help is much appreciated. Thanks in advance.
Environment:
The text was updated successfully, but these errors were encountered: