Getting error when trying to map Azure fileshare to on-prem windows machine

Anonymous
2023-03-28T06:53:14.88+00:00

Hello,

I'm trying this for the first time, so not sure if it was supposed to work or not.

I have a private endpoint on a storage account and trying to map the fileshare in my windows machine (non-cloud) using the script option from Azure file share connect portal and getting this error:

New-PSDrive : The specified network password is not correct
At line:5 char:5
+     New-PSDrive -Name Z -PSProvider FileSystem -Root "\\zneens1p19cpa ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Z:PSDriveInfo) [New-PSDrive], Win32Exception
    + FullyQualifiedErrorId : CouldNotMapNetworkDrive,Microsoft.PowerShell.Commands.NewPSDriveCommand

In storage account, I'm using access keys and not AAD. Any suggestions to what needs to be done?

Azure Storage
Azure Storage
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
3,529 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Sumarigo-MSFT 47,466 Reputation points Microsoft Employee Moderator
    2023-03-28T15:41:29.64+00:00

    @Gupta, Deepanshu Welcome to Microsoft Q&A Forum, Thank you for posting your query here!

    • May I know which version of windows OS are you using?
    • Make sure that the access key being used to authenticate to the Azure file share is correct. You can check the access key in the Azure portal under the "Access keys" section of your storage account.
    1. Check if the correct syntax is being used to map the file share. In your case, the correct syntax is: New-PSDrive -Name Z -PSProvider FileSystem -Root "\\storageaccount.file.core.windows.net\sharename" -Credential $(Get-Credential) Replace "storageaccount" with the name of your storage account and "sharename" with the name of your file share.
    2. Make sure that the Windows machine has the necessary permissions to access the Azure file share. Specifically, make sure that port 445 is open on the Windows machine and that the SMB 1.0/CIFS File Sharing Support feature is enabled.
    3. Try using a different access key to authenticate to the Azure file share. If you have multiple access keys, try using a different one to see if the issue is with the access key being used.
    4. Try using a different Windows machine to access the Azure file share. This can help you verify if the issue is with the Windows machine or the Azure file share.

    Based on the error message, can you please cross verify port 445 is enabled. If few Internet provider have blocked port 445, please refer to this article

    206727-image.png

    SMB has always been a network file sharing protocol. As such, SMB requires network ports on a computer or server to enable communication to other systems. SMB uses either IP Port 445 . 445 is an important port because it is used by default for all SMB communication. Windows uses it for various functions since SMB serves as the network protocol at the application level.

    I would also recommend to cross verify the prerequisites once again

    Check that you have entered the correct storage account name and file share name in the script.

    1. Check that you have entered the correct storage account key in the script.
    2. Check that the storage account key has not expired. If it has, you can regenerate the key in the Azure portal.
    3. Check that the storage account firewall is not blocking your IP address. You can add your IP address to the storage account firewall in the Azure portal.
    4. Check that your Windows machine is connected to the internet and can access the storage account.
    5. Try running the script again with the correct credentials.

    Symptoms
    You have found that the TCP port 445 is blocked.

    Customer can talk to the ISP to check if they can allow all communication to URLS ".file.core.windows.net " (Suffix used for storage accounts) and ".store.core.windows.net" (Suffix used by the storage stamp).

    Resolution:

    Solution 1 - Use Azure File Sync
    Azure File Sync can transform your on-premises Windows Server into a quick cache of your Azure file share. You can use any protocol that's available on Windows Server to access your data locally, including SMB, NFS, and FTPS. Azure File Sync works over port 443 and can thus be used as a workaround to access Azure Files from clients that have port 445 blocked. Learn how to setup Azure File Sync.

    Solution 2 - Use VPN
    By Setting up a VPN to your specific Storage Account, the traffic will go through a secure tunnel as opposed to over the internet. Follow the instructions to setup VPN to access Azure Files from Windows.

    Solution 3 - Unblock port 445 with help of your ISP/IT Admin
    Work with your IT department or ISP to open port 445 outbound to Azure IP ranges.

    Solution 4 - Use REST API based tools like Storage Explorer/Powershell
    Azure Files also supports REST in addition to SMB. REST access works over port 443 (standard tcp). There are various tools that are written using REST API which enable rich UI experience. Storage Explorer is one of them. Download and Install Storage Explorer and connect to your file share backed by Azure Files. You can also use PowerShell which also user REST API.

    Additional information: You can mount the file share on your local machine by using the SMB 3.0 protocol, or you can use tools like Storage Explorer to access files in your file share. From your application, you can use storage client libraries, REST APIs, PowerShell, or Azure CLI to access your files in the Azure file share.

    Azure Files only allows connections using SMB 3.0 (with encryption support) from outside the region or datacenter. SMB 3.0 protocol has introduced many security features including channel encryption which is very secure to use over internet. However its possible that port 445 has been blocked due to historical reasons of vulnerabilities found in lower SMB versions. In ideal case, the port should be blocked for only for SMB 1.0 traffic and SMB 1.0 should be turned off on all clients.

    If you still face any issue in mounting Azure file share, please let me know I would like to work closer on this issue


    Please do not 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

  2. Dmitrii 1 Reputation point
    2023-10-10T12:17:21.83+00:00

    Guys, who works from Windows and just created Azure file share, and cannot connect with it by running "\\<storageaccount>.file.core.windows.net\<sharename>" from a File explorer, for a first time connect it as a network drive:

    1. Open the File explorer
    2. Left click on the Network and select "Map network drive"
    3. Check "Connect using different credential"
    4. When popup appears use creds from Azure Storage account / Access keys and below you can check "Remember my credentials", after that press OK.

    If connection succes you can disconnect the new network drive if not needed, but what is more important - from now you can use "\\<storageaccount>.file.core.windows.net\<sharename>" to open your share from the File explorer.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.