我正在使用以下命令在 Windows Azure 虚拟机上挂载文件:
$connectTestResult = Test-NetConnection -ComputerName aaadcstore.file.core.windows.net -Port 445
if ($connectTestResult.TcpTestSucceeded) {
# Save the password so the drive will persist on reboot
cmd.exe /C "cmdkey /add:`"aaadcstore.file.core.windows.net`" /user:`"Azure\*******`" /pass:`"*****************`""
# Mount the drive
New-PSDrive -Name Z -PSProvider FileSystem -Root "\\aaadcstore.file.core.windows.net\amazefileshare" -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."
}
但是我的连接 TcpTest 未成功我已使用 NSG 打开 445,但仍然无法工作。
最佳答案
从错误消息来看,可能是您的 Azure VM 上的 DNS 问题。
您可以验证是否在 Azure VM 所在的 Azure VNet 中使用 Azure 提供的 DNS 服务器。如果使用自定义 DNS 服务器并确保它应该能够解析 Azure 文件共享 FQDN。您需要重新启动 Azure VM 以更新 DNS 服务器设置。
关于Azure 文件共享无法使用 powershell 脚本连接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67869285/