0

I am trying to write a file to a location on a shared network drive on a remote server. When I run my code in my local environment, it works successfully and I can upload files. However, when running the code from an Azure WebJob, I get

Access to the path is denied

or

Access is denied

I am accessing the netwrok share using a method as posted here

and implementing as follows:

using (NetworkShareAccesser.Access(REMOTE_COMPUTER_NAME, DOMAIN, USER_NAME, PASSWORD))
{
    File.WriteAllText(string.Format(@"{0}\TestFileName.csv", networkPath), sb.ToString());
}

As I say, if I run this on my local pc, it works and uploads the file. Something is different when running from an Azure WebJob. Is there some extra permission/ security required to access the shared drive from Azure?

Thanks in advance.

Johnathan
  • 879
  • 3
  • 12
  • 22
  • Where is the remote machine located? – Patrick Hofman Apr 26 '18 at 12:08
  • 1
    Well, is the machine with the share available over the internet? – Lasse V. Karlsen Apr 26 '18 at 12:09
  • @PatrickHofman somewhere in Western EU is all I know. – Johnathan Apr 26 '18 at 12:12
  • @LasseVågsætherKarlsen So I am told. It is the server of a client who have informed me that the share is accessible over the internet. Does this sound like the most likely suspect to you? – Johnathan Apr 26 '18 at 12:13
  • 1
    It's an astonishingly brave (stupid) client that leaves an [SMB share open to the internet](https://security.stackexchange.com/a/155177/66596). I'd flag this up to them as something that they ***really*** shouldn't be doing. – spender Apr 26 '18 at 12:18

0 Answers0