I was trying to upload a file to Azure file share using my C# code. using the Managed identity. The code will be deploying to an azure VM which has managed identity with the Storge account. how to connect using a console app via DefaultAzureCredential. pls help me.
Asked
Active
Viewed 1,373 times
1
-
Please provide enough code so others can better understand or reproduce the problem. – Community Oct 18 '21 at 20:27
-
Uri url = new Uri("https://XXXXXXX.file.core.windows.net/share1/stage/1/2"); var cred = new DefaultAzureCredential(); ShareFileClient client = new ShareFileClient() . I am trying to access this path using an DefaultAzureCredential to upload my files from an console application to Azure fileStorage. But, I am not getting any option to keep DefaultAzureCredential along with ShareFileClient class. – Jack Johns Oct 19 '21 at 00:23
2 Answers
2
Looking at constructor options for ShareServiceClient
, I believe it is not possible to connect to your File Share Service using Azure AD (thus ruling out using Managed Identities) at least with SDK version 12.8.0.
What you will need to do is use Shared Access Signature, or use Storage Account Name/Key or specify Storage Account connection string to connect to your File Service.

Gaurav Mantri
- 128,066
- 12
- 206
- 241
0
Try connecting using any Azure AD identity (say your idnetity) synced to Azure AD Domain Services. Select an identity in AD DS and give permissions say Contributor access to the identity and try using DefaultAzureCredential after logging in using the said identity.

Ambar Ray
- 1
- 1