Have a Windows service running in a Azure Windows Server 2022 VM, also mapped the Azure file share to a Windows drive Z:\ in this VM according to this tutorial, the Windows service is trying to create a folder ABC in the Z:\test folder, but it didn't work, how to fix this?
Directory.CreateDirectory("Z:\\test\\ABC");
I tried to reproduce the same in my environment and got below results:
I have storage account with one file share named
srifileshare
like below:In that file share, I added one directory named
test
like below:To map file share to Windows VM, I got Powershell script from here:
When I ran the above script in my Windows VM, it mapped to file share successfully like below:
When I checked the same in File Explorer, Z drive is available with
test
folder in it like below:When I tried to create
ABC
folder insidetest
folder, it created successfully like below:I checked the same in Portal where
ABC
directory is created in file share successfully like below:In your case, try changing the path from
Z:\\test\\ABC
to below:Reference:
Directory.CreateDirectory Method (System.IO) Microsoft