Azure Files Mount - Azure VM(domain joined) Network path not found issue

PGS 1 Reputation point
2021-01-15T08:55:31.657+00:00

Hi, We have provisioned Azure Windows (2019) VM in our virtual network and the VM is domain joined. We created a storage account and want to mount this Azure Files storage to this VM in Azure. But we are getting error - network path found. We are using storageaccount key to connect to VM
But if we remove the Azure VM from company domain, we are able to mount the fileshare without any issue using the same script.

Below is the mount script & error log -
Command

$connectTestResult = Test-NetConnection -ComputerName myfileshare.file.core.windows.net -Port 445  
if ($connectTestResult.TcpTestSucceeded) {  
# Save the password so the drive will persist on reboot  
cmd.exe /C "cmdkey /add:`"myfileshare.file.core.windows.net`" /user:`"Azure\myfileshare`" /pass:`"+vvvvvvvvvvvvvvvvvvvvvvvvv==`""  
# Mount the drive  
New-PSDrive -Name Y -PSProvider FileSystem -Root "\\myfileshare.file.core.windows.net\\fileshare" -Persist  
} 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."

 }

Error

CMDKEY: Credential added successfully.
New-PSDrive : The network path was not found
At line:6 char:5
+ New-PSDrive -Name Y -PSProvider FileSystem -Root "\capturefilesh ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Y:PSDriveInfo) [New-PSDrive], Win32Exception
+ FullyQualifiedErrorId : CouldNotMapNetworkDrive,Microsoft.PowerShell.Commands.NewPSDriveCommand

Azure Files
Azure Files
An Azure service that offers file shares in the cloud.
1,183 questions
Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,257 questions
Azure Virtual Network
Azure Virtual Network
An Azure networking service that is used to provision private networks and optionally to connect to on-premises datacenters.
2,198 questions
Microsoft Entra
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Joshua Thompson 156 Reputation points
    2022-07-28T17:17:57.143+00:00

    For anybody else having this problem, here was how I resolved my issue.
    I downloaded AzDiagnostics.ps1 from git hub and ran it against my storage account/fileshare on my Azure VM
    Instructions here on how to download:
    https://github.com/Azure-Samples/azure-files-samples/tree/master/AzFileDiagnostics/Windows

    Download the zip and look for the AzFileDiagnostics.ps1 file located in "azure-files-samples-master\azure-files-samples-master\AzFileDiagnostics\Windows"

    I then ran:
    .\AzFileDiagnostics.ps1 -UNCPath \storageaccountname.file.core.windows.net\sharename

    The output showed me my LmCompatibility Level in "Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" was set to 1. It stated it needed to be 3 or mounting shares would fail.

    I changed to 3 and reran the map drive power shell script. Boom! All good now.

    Also found the below on MS docs. Great info
    https://learn.microsoft.com/en-us/answers/questions/727502/azure-file-share-mount-issue.html

    4 people found this answer helpful.

  2. deherman-MSFT 34,021 Reputation points Microsoft Employee
    2021-01-15T17:18:24.467+00:00

    @PGS
    Since the issue only happens when the VM is domain joined I suspect a possible DNS issue. Are you able to resolve the storage endpoint when the VM is domain joined. If this is the issue you might look into setting up DNS forwarding. I recommend running the AzFileDisagnostics tool to see what it finds. You can also find more information in our troubleshooting guide.

    Hope this helps. If you are still facing issues or have further questions please let us know.

    -------------------------------

    Please don’t forget to "Accept the answer" and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    0 comments No comments

  3. Joshua Thompson 156 Reputation points
    2022-07-28T16:54:02.297+00:00

    @PGS Did you ever get this one figured out?

    I am having the exact same issue.
    Azure VM joined to domain via site to site VPN, trying to connect to Azure file share directly from the Azure VM. Same error

    The first part of the powershell command succeeds:
    Test-NetConnection -ComputerName myfileshare.file.core.windows.net -Port 445

    ComputerName : (myfileshare).file.core.windows.net
    RemoteAddress : 20.60.14.200
    RemotePort : 445
    InterfaceAlias : Ethernet
    SourceAddress : 10.0.0.4
    TcpTestSucceeded : True

    That 'test-NetConnection' output shows that the hostname is resolving properly.

    The powershell script is erroring out on line 6:
    New-PSDrive -Name Z -PSProvider FileSystem -Root "\(storage account name).file.core.windows.net(file share name)" -Persist

    "The network path was not found.)

    Any advice?

    0 comments No comments