How to connect to Azure storage File share using Managed Identity from an application

Punugoti, Ashwin 20 Reputation points
2024-09-25T20:54:12.71+00:00

I am looking to connect to azure storage account (File share) using Managed identity

Azure Storage Accounts
Azure Storage Accounts
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,220 questions
0 comments No comments
{count} votes

Accepted answer
  1. hossein jalilian 8,160 Reputation points
    2024-09-25T22:03:52.5+00:00

    Thanks for posting your question in the Microsoft Q&A forum.

    Grant the Managed Identity the Storage File Data SMB Share Contributor role on the storage account or file share

    Use the Azure SDK in your application to authenticate and access the file share:

    using Azure.Identity;
    using Azure.Storage.Files.Shares;
    
    var credential = new DefaultAzureCredential();
    
    string storageAccountName = "your_storage_account_name";
    string fileShareName = "your_file_share_name";
    string endpoint = $"https://{storageAccountName}.file.core.windows.net";
    
    ShareClient shareClient = new ShareClient(new Uri(endpoint), fileShareName, credential);
    
    

    Managed Identity cannot be used for mounting Azure File Shares directly. It's primarily used for programmatic access through the REST API or SDKs


    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful


2 additional answers

Sort by: Most helpful
  1. Marcin Policht 25,755 Reputation points MVP
    2024-09-25T22:10:53.94+00:00

    This is not supported. As per https://learn.microsoft.com/en-us/answers/questions/1620270/how-do-i-mount-an-azure-file-share-in-azure-contai Managed Identity cannot be used for mounting Azure File Shares


    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin

    0 comments No comments

  2. Sumarigo-MSFT 47,021 Reputation points Microsoft Employee
    2024-09-26T15:13:39.3366667+00:00

    @Punugoti, Ashwin Welcome to Microsoft Q&A Forum, Thank you for posting your query here!

    Managed identity support for SMB shares is on the roadmap and is being worked upon. (it is in the development pipeline and will be available very soon, although there is no ETA for now.

    We will keep you updated once the feature is released, Get the latest updates on Azure products and features to meet your cloud investment needs. Subscribe to notifications to stay informed Azure updates

    Please let us know if you have any further queries. I’m happy to assist you further.     


    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.