Reputation: 3541
I am trying to map a blob storage to Z:
with the drive label "Azure Blob Storage" but for some reason the location is not recognized.
I am getting this exception:
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.
LSTest represents the FOLDER TO MAP
parameter
The first thing I did is telnet
to see if port is open:
C:\Windows\system32>telnet https://analyticsdev.blob.core.windows.net/ 445
Connecting To https://analyticsdev.blob.core.windows.net/...Could not open connection to the host, on port 445: Connect failed
I also did nslookup
, but it didn't find the storage location apparently
How didn't it find it when clearly it exists given my screenshot?
also telnet with address+port:
C:\Windows\system32>nslookup https://analyticsdev.blob.core.windows.net/
Server: XXXXX.attlocal.net
Address: 2600:...::1
*** XXXXX.attlocal.net can't find https://analyticsdev.blob.core.windows.net/: Non-existent domain
This is my script:
#set default values
if(!$BLOB_STORAGE_LOCATION) {
$BLOB_STORAGE_LOCATION = "https://analyticsdev.blob.core.windows.net/"
}
if(!$STORAGE_ACCOUNT_NAME) {
$STORAGE_ACCOUNT_NAME = "analyticsdev"
}
if(!$ACCESS_KEY) {
$ACCESS_KEY = "2*********************="
}
if(!$FOLDER_TO_MAP) {
$FOLDER_TO_MAP = "LSTest"
}
if(!$DRIVE_LETTER) {
$DRIVE_LETTER = "Z"
}
if(!$DRIVE_LABEL) {
$DRIVE_LABEL = "Azure Blob Storage"
}
<#
Author: Hadi Nasser
Purpose: This script will map a Blob Storage as network drive
#>
$connectTestResult = Test-NetConnection -ComputerName $BLOB_STORAGE_LOCATION -Port 445
if ($connectTestResult.TcpTestSucceeded) {
# Save the password so the drive will persist on reboot
cmd.exe /C "cmdkey /add:`"$BLOB_STORAGE_LOCATION`" /user:`"$STORAGE_ACCOUNT_NAME`" /pass:`"$ACCESS_KEY`""
# Mount the drive
New-PSDrive -Name $DRIVE_LETTER -PSProvider FileSystem -Root "\\$BLOB_STORAGE_LOCATION\$FOLDER_TO_MAP" -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."
}
(New-Object -ComObject Shell.Application).NameSpace("$($DRIVE_LETTER):").Self.Name = $DRIVE_LABEL
Upvotes: 1
Views: 5818
Reputation: 1886
As suggested by @Gaurav Mantri in the comment section you can not mount the blob container. You can mount the file share. please check this to Mount SMB Azure file share on Windows
based on the error you are getting it seems like port 445 is blocked in your network. please Work with your IT department or ISP to open port 445 outbound .
You can find some other options available in this thread
Upvotes: 1