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
CodePudding user response:
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 inside test
folder, it created successfully like below:
I checked the same in Portal where ABC
directory is created in file share successfully like below:
Note that, only UNC paths are supported to create a directory on a remote computer or on a share
In your case, try changing the path from Z:\\test\\ABC
to below:
Directory.CreateDirectory("\\\\<storageaccountname>.file.core.windows.net\\<storagefilesharename>\\test\\ABC");
Reference: