How to connect Azure App Service with on-premise shared folder?

Byrd 6 Reputation points
2022-06-27T01:00:11.047+00:00

Hi,

I have a web api hosted in Azure App Service. This api will read/write files on the on-premise network folder (e.g. \SERVERNAME\FOLDER1\ ). The code below works fine, if the api is hosted on the same network with the network folder.

using (StreamWriter sw = new StreamWriter(@"\\SERVERNAME\FOLDER\somefile.txt"))  
{  
    sw.WriteLine("HELLO WORLD!");  
 }  

When I deployed to Azure App Service, obviously that it would not work since Azure App Service does not know or has any access to \SERVERNAME. How can I archive this problem? I was trying to setup VNet integration, but I can't get it working.

Thank you,

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,312 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sachin Gupta 1 Reputation point
    2022-06-27T10:48:19.213+00:00

    Hi @Byrd Thanks for asking a question!

    No Azure App Service Is an Island
    The purpose of an app service is to allow someone or something to connect to it, or for it to connect to something, and do some service. Internal users or external clients need to connect to a line-of-business (LOB) application interface. Partners or suppliers need to connect to an application via an API. Or an application might need to integrate with some external service, such as a database.

    1. VNet Integration with private endpint link
      A Standard, Premium, or Isolate app service plan offers the ability for an app service to connect with a virtual network via a point-to-site VPN. The virtual network must have a VPN gateway that is Basic/Dynamic, VpnGw1 or higher size, and configured for point-to-site connectivity.
    2. Hybrid Connection

    This is a feature that I really like and in conversations that I’ve had, it seems to be an approach that few are aware of. However, it has been available for years in the Basic, Standard, and Premium plans.

    -------------------------------------------------------------------------------------------------------------------

    Also, the best way to share your feedback would be to create a User Voice feedback item and upvote it. The product group monitors this site for feedback. This is the best way to ensure you are heard and you may receive a response depending on how much information they can currently share.

    0 comments No comments

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.