I have an Azure file storage account which I created a share on. I have 2 Azure VMs, one running SQL server and one running IIS and a Windows service (written in c# .net 4.5.1). I need them both to access the share to share files. I have read several articles and have tried to persist credentials using cmdkey and map the drive with net use. I am running into 2 problems.
On the SQL VM, everything seems to work fine. It is writing files to the share and I haven't had much trouble there. On the other VM I'm having problems. First, the persist bit doesn't seem to actually work. I run it, verify it's stored (shows up when I do cmdkey /list, and in the credentials manager), and I can map the drive using net use. It appears to work. I can browse to the drive in Explorer, but if I log off the machine it doesn't reconnect when I log back in. The connection seems to be lost as soon as I log out of the VM until I run net use again. Second, even when I can browse to the folder, the Windows service can't find it at all. I've verified the path is correct that it's looking for. I copied and pasted it into an Explorer window and it goes right to the folder. I tried running the service as Local System, as the account I log into the VM with... All give the path not found error. As far as I've been able to find, the only 2 things I'm supposed to need are the cmdkey command and the net use command and the drive should be usable and reconnect automatically. Am I missing something?
Edit: I forgot to mention, if I run the service as a console app on the same machine, it does find the folder and runs properly. Run as a service, it does not. It is configured to be able to run as either using the method found at http://www.dontpaniclabs.com/blog/post/2011/10/20/running-a-service-as-an-application/