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

标签 azure powershell azure-virtual-machine

我正在使用以下命令在 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 服务器设置。

enter image description here

关于Azure 文件共享无法使用 powershell 脚本连接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67869285/

相关文章:

azure - 使用 Polybase 生成的 Parquet 文件不包含列名

git - vbcs.cache/edb.log 被 Visual Studio 2015 锁定

sql - 将 Azure bacpac 文件导入本地数据库时出错 EXTERNAL 附近的语法错误

powershell - 如何使用 Ansible 卸载 Chocolatey 软件包?

windows - 如何使用 PowerShell 扩展 ZIP 存档(UTF-8 文件名)

python - 如何从 Azure blob 数据存储获取 Python pathlib 路径?

windows - 在 PowerShell 中使用 sudo 和 SSH-Session

azure - 使用 O365 帐户连接到 Azure VM 中的 SMTP 中继失败

azure - 如何更改Azure虚拟机中的时区?

dns - 如何为Azure虚拟机设置自定义域?