如何使用 AD 凭据挂载 Azure 文件?

问题描述

我设置了一个 P2S VPN,上面有一些 Linux 和 Windows 虚拟机。我还有一个带有 Azure Files 文件共享的存储帐户。我一直在按照 this guide 中的步骤尝试在我的计算机上装载我的 Azure Files 文件共享。我可以使用存储帐户密钥成功挂载驱动器,但无法使用我的 AD 凭据挂载它。我已经创建了 Azure AD DS 服务并将其链接到我的 AD 租户。每当我尝试使用我的 AD 凭据挂载驱动器时,我都会得到 System error 86 has occurred. The specified network password is not correct. 我还在存储帐户中启用了 Azure AD DS 身份验证并重置我的密码以便对其进行哈希处理。

如何使用 AD 凭据从连接到 VPN 的计算机挂载文件共享?

解决方法

尝试将驱动器映射到存储帐户文件共享时出现错误 86。

使用 Azure AD 身份验证的 Azure 文件共享:为什么不支持当前方案。

仅当共享映射到 Azure 上运行的 VM 并按照以下文档加入 Azure AD 时,才支持使用 Azure AD 身份验证的 Azure 文件:

https://docs.microsoft.com/en-us/azure/storage/files/storage-files-identity-auth-active-directory-enable

无论如何要创建某种用户角色来访问文件共享,就像您可以使用 Azure\StorageAccountName 映射驱动器并将密码作为存储密钥一样?因此,以某种方式使用密钥/密码创建其他 Azure\用户名,该密钥/密码也可以访问 Sotrage 帐户/文件共享。

当您转到门户上的文件共享并单击连接选项时,它会显示一个脚本来使用文件共享的默认连接凭据(完全独立于 Azure AD 凭据)映射文件共享,这些凭据提供超级用户/admin/root 访问文件共享,因此完全没有限制。这是存储帐户的默认用户,不能创建其他此类用户。

$connectTestResult = Test-NetConnection -ComputerName snapshotstest.file.core.windows.net -Port 445
if ($connectTestResult.TcpTestSucceeded) {
    # Save the password so the drive will persist on reboot
    cmd.exe /C "cmdkey /add:`"snapshotstest.file.core.windows.net`" /user:`"Azure\snapshotstest`" /pass:`"StorageAcountKey`""
    # Mount the drive
    New-PSDrive -Name Z -PSProvider FileSystem -Root "\\snapshotstest.file.core.windows.net\snapshotstest"-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."
}

根据错误信息,您可以参考此处提到的建议Error 86 Specified password is incorrect

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...