我当前正在尝试在用户登录时使用本地组策略脚本来安装存储用户 FSLogix 帐户的新驱动器 (F:)。我不知道这是否可能或我的选择是什么。
我这样做的原因是因为我正在尝试实现 Azure 虚拟桌面设置的一键部署,并希望将测试用户数据存储在 Azure 文件共享中并展示 FSLogix 帐户的使用。我需要某种方法首先将 Azure 文件共享链接到 VM,并将 FSLogix 注册表设置设置为该文件共享,然后加载 FSLogix 用户帐户。
有人对如何最好地做到这一点有经验或想法吗?
用于使用 Azure 文件为 Azure 虚拟桌面设置 FSLogix。您可以按照以下步骤操作-
先决条件
如果还没有,请创建一个新的存储帐户。
az storage account create --name <YourStorageAccountName> --resource-group <YourResourceGroupName> --location <Location> --sku Standard_ZRS --kind StorageV2
创建文件共享
az storage share create --name <YourFileShareName> --account-name <YourStorageAccountName>
获取存储帐户密钥
$storageKey = az storage account keys list --resource-group <YourResourceGroupName> --account-name <YourStorageAccountName> --query "[0].value" --output tsv
为 AD 域服务的 Azure 文件共享分配适当的权限。
在 AVD 主机池中,创建登录脚本以在用户登录时挂载文件共享。
$storageAccountName = "<YourStorageAccountName>"
$fileShareName = "<YourFileShareName>"
$driveLetter = "F"
$storageKey = "<YourStorageKey>"
#Mapping the drive
New-PSDrive -Name $driveLetter -PSProvider FileSystem -Root "\\$storageAccountName.file.core.windows.net\$fileShareName" -Persist -Credential (New-Object System.Management.Automation.PSCredential ("Azure\$storageAccountName", (ConvertTo-SecureString $storageKey -AsPlainText -Force)))
通过 PowerShell 配置 FSLogix,即在 AVD VM 上,设置 FSLogix 注册表项。
$regPath = "HKLM:\SOFTWARE\FSLogix\Profiles"
$fileSharePath = "\\$storageAccountName.file.core.windows.net\$fileShareName"
# Ensure the registry path exists
if (-not (Test-Path $regPath)) {
New-Item -Path $regPath -Force
}
# Configure the VHDLocations registry key
Set-ItemProperty -Path $regPath -Name "VHDLocations" -Value $fileSharePath
# Enable FSLogix Profile Containers
Set-ItemProperty -Path $regPath -Name "Enabled" -Value 1
完成。您现在可以登录到 AVD 会话并确保 F: 驱动器已安装并指向您的 Azure 文件共享。
参考资料: