1

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.

2 Answers 2

0

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

1
  • Please do not provide links only.
    – bjoster
    Sep 20 at 13:05
0

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.

$connectTestResult = Test-NetConnection -ComputerName {mystorageaccount}.file.core.windows.net -Port 445
if ($connectTestResult.TcpTestSucceeded) {
    # Save the password so the drive will persist on reboot
    cmd.exe /C "cmdkey /add:`"{mystorageaccount}.file.core.windows.net`" /user:`"localhost\{mystorageaccount}`" /pass:`"{mystorageaccountpassword}"
    # Mount the drive
    #New-PSDrive -Name Z -PSProvider FileSystem -Root "\\{mystorageaccount}.file.core.windows.net\{myfileshare}" -Persist
    Net use z: \\{mystorageaccount}.file.core.windows.net\{myfileshare} /persistent:yes
} else {
    Write-Error -Message "Unable to reach the Azure storage account via port 445. Check to make sure your organization or ISP is not blocking port 445, or use Azure P2S VPN, Azure S2S VPN, or Express Route to tunnel SMB traffic over a different port."
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .