I have set up a Azure Storage Account File Share (with private endpoints) and am trying to map the network location to my Virtual Machine (not domain joined) in the same virtual network by following this MS article.
I am trying to get this network location assigned when the user logs on by placing a batch file with the below code in the C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp folder.
net use z: /delete
net use z: "\\{myaccount}.file.core.windows.net\{myfileshare}"
When logging on as a local admin account it works creating the network location but when I try to do the same under a user account it fails with error 55: The Specified Network Resource or Device is No Longer Available Error.
I'm assuming this is a local permissions issue, any know the correct permissions to resolve this problem.
Looks a lot like a permission issue, I would start by using the following script that is specifically made for troubleshooting Azure Files: https://github.com/Azure-Samples/azure-files-samples/tree/master/AzFileDiagnostics/Windows
It automates most of the troubleshooting steps provided by this article which is also very helpful https://learn.microsoft.com/en-us/troubleshoot/azure/azure-storage/files-troubleshoot?tabs=powershell
So I took a slightly different direction to get this working. Using the script provided by Azure Portal via the file share connect button does not always create the share as the New-PSDrive function does not appear to create a persistant mapping even with the -Persist option.
I switched the New-PSDrive command out to Net Use and created a Windows Task Schedule to run the script for all users on logon and unlock and its working great.