【发布时间】:2021-10-29 09:23:13
【问题描述】:
我正在尝试使用驱动器标签“Azure Blob Storage”将 Blob 存储映射到 Z:,但由于某种原因无法识别该位置?
我遇到了这个异常:
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代表FOLDER TO MAP参数
我做的第一件事是telnet 看看端口是否打开:
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
我也做了nslookup,但是明显没找到存放位置
根据我的截图,当它明显存在时它怎么没有找到它?
也可以通过地址+端口进行远程登录:
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
这是我的脚本:
#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
【问题讨论】:
-
您无法以这种方式连接到 Azure Blob 存储。仅适用于 Azure 文件存储。
-
@GauravMantri 所以你的意思是“文件共享”数据存储而不是容器是我应该使用的?
-
没错。您可以挂载文件共享而不是 Blob 容器。
-
@GauravMantri 即使文件共享失败:
C:\Windows\system32>telnet https://analyticsdev.file.core.windows.net/ls-test 445错误:Connecting To https://analyticsdev.file.core.windows.net/ls-test...Could not open connection to the host, on port 445: Connect failed -
在执行 telnet 或 nslookup 时,您需要指定主机,而不是 URL。
nslookup analyticsdev.blob.core.windows.net Server: localhost Address: 127.0.0.1 Non-authoritative answer: Name: blob.db3prdstr13a.store.core.windows.net Address: 52.239.137.68 Aliases: analyticsdev.blob.core.windows.net
标签: azure powershell azure-blob-storage