【问题标题】:Azure file share can not connect using powershell script?Azure 文件共享无法使用 powershell 脚本连接?
【发布时间】:2021-08-24 09:36:01
【问题描述】:

我正在使用以下命令在 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 但仍无法正常工作。

【问题讨论】:

  • 你能在虚拟机的 PowerShell 控制台中运行Test-NetConnection -ComputerName aaadcstore.file.core.windows.net -Port 445 并分享输出吗?
  • @Gaurav o/p:警告:amazedcstore.file.core.windows.net 的名称解析失败--状态:没有这样的主机已知计算机名称:amazedcstore.file.core.windows.net RemoteAddress : InterfaceAlias : SourceAddress : PingSucceeded : False
  • 谢谢。当您从本地计算机运行相同的命令时会发生什么?
  • 从本地 o/p 警告:TCP 连接到 (20.60.128.136 : 445) 失败警告:Ping 到 20.60.128.136 失败,状态为:TimedOut ComputerName : amazedcstore.file.core.windows.net RemoteAddress : 20.60.128.136 RemotePort: 445 InterfaceAlias: Wi-Fi 3 SourceAddress: 192.168.1.102 PingSucceeded: False PingReplyDetails (RTT): 0 ms TcpTestSucceeded: False

标签: azure powershell azure-virtual-machine


【解决方案1】:

从错误消息来看,可能是您的 Azure VM 上的 DNS 问题。

您可以验证是否在 Azure VM 所在的 Azure VNet 中使用 Azure 提供的 DNS 服务器。如果你使用自定义 DNS 服务器并确保它应该能够解析 Azure 文件共享 FQDN。您需要重新启动 Azure VM 以更新 DNS 服务器设置。

【讨论】:

  • 给定的解决方案像魅力一样对我有用.....谢谢。
猜你喜欢
  • 2018-06-22
  • 2015-04-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-05-13
  • 2020-09-17
  • 2020-05-07
  • 1970-01-01
相关资源
最近更新 更多