繁体   English   中英

Azure 文件共享无法使用 powershell 脚本连接?

[英]Azure file share can not connect using powershell script?

我正在使用以下命令在 windows azure vm 上安装文件:

$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 VNet 中使用 Azure 提供的 DNS 服务器,其中 Azure VM 所在的位置。 如果您使用自定义 DNS 服务器并确保它应该能够解析 Azure 文件共享 FQDN。 您需要重新启动 Azure VM 以更新 DNS 服务器设置。

在此处输入图像描述

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM