How to Mount Azure file share to my cloud service in .net application.

Jeevarishi Nallaselvam 21 Reputation points
2023-12-20T12:05:56.4433333+00:00

I have a Azure SMB File share, Existing code uses the Microsoft.WindowsAzure.Storage client library to Mount the File share to the cloud service. As the Microsoft.WindowsAzure.Storage is deprecated I am migrating the client library to Azure.Storage.Files.Shares and it doesn't provide the functionality to Mount the drive.

My application is running in .Net framework 4.6.2 MVC

Is there a way I can mount the drive on the startup ? I even tried the script from the azure portal connection test was failure.

I am looking for a solution which can mount from my .Net application itself. Because File share needs to be mounted to all the instances on the time of autoscalling.

//Existing code using Microsoft.WindowsAzure.Storage 
CloudFileShare share = CloudStorageAccount.Parse("Connection string")
    .CreateCloudFileClient()
    .GetShareReference("reports");
share.CreateIfNotExists();
share.Mount("Z:");
Azure Files
Azure Files
An Azure service that offers file shares in the cloud.
1,410 questions
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,490 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Silvia Wibowo 5,871 Reputation points Microsoft Employee Moderator
    2023-12-22T03:34:58.23+00:00

    Hi @Jeevarishi Nallaselvam , I understand that you want to mount Azure Files to your application, which is using .Net framework. I am not a .Net developer, so I'm not sure about compatibility of your .Net framework version with Azure Storage File Shares client library for .NET. Please try that out and let us know.

    Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is how.


  2. Sumarigo-MSFT 47,531 Reputation points Microsoft Employee Moderator
    2023-12-29T07:09:41.6666667+00:00

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

    • May I know what exatcly are trying to accomplish? Are you trying to Mount Azure File Share on VM instance?
    • As you mentioned you tried to through portal did you get any error message? If so can you share the screenshot?
    • Where will be this .Net application will be hosted?

    Try to mount Azure file share as per the below mentioned article and let me know the status.

    Reference link: Mount SMB Azure file share on Windows

    User's image

    This article lists common issues related to Azure Files. It also provides possible causes and resolutions for these issues. https://learn.microsoft.com/en-us/troubleshoot/azure/azure-storage/files-troubleshoot?tabs=powershell

    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.