动态挂载 FSLogix 驱动器并设置 VHDLocations

问题描述 投票:0回答:1

我当前正在尝试在用户登录时使用本地组策略脚本来安装存储用户 FSLogix 帐户的新驱动器 (F:)。我不知道这是否可能或我的选择是什么。

我这样做的原因是因为我正在尝试实现 Azure 虚拟桌面设置的一键部署,并希望将测试用户数据存储在 Azure 文件共享中并展示 FSLogix 帐户的使用。我需要某种方法首先将 Azure 文件共享链接到 VM,并将 FSLogix 注册表设置设置为该文件共享,然后加载 FSLogix 用户帐户。

有人对如何最好地做到这一点有经验或想法吗?

windows azure powershell active-directory windows-virtual-desktop
1个回答
0
投票

用于使用 Azure 文件为 Azure 虚拟桌面设置 FSLogix。您可以按照以下步骤操作-

先决条件

  • 具有创建资源权限的 Azure 订阅。
  • Azure 虚拟桌面环境已设置。
  • 为 FSLogix 配置文件创建的 Azure 文件共享。
  • FSLogix 代理安装在 AVD 虚拟机上。

如果还没有,请创建一个新的存储帐户。

az storage account create --name <YourStorageAccountName> --resource-group <YourResourceGroupName> --location <Location> --sku Standard_ZRS --kind StorageV2

enter image description here

创建文件共享

az storage share create --name <YourFileShareName> --account-name <YourStorageAccountName>

enter image description here

获取存储帐户密钥

$storageKey = az storage account keys list --resource-group <YourResourceGroupName> --account-name <YourStorageAccountName> --query "[0].value" --output tsv

enter image description here

为 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)))

enter image description here

通过 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

enter image description here

完成。您现在可以登录到 AVD 会话并确保 F: 驱动器已安装并指向您的 Azure 文件共享。

参考资料:

© www.soinside.com 2019 - 2024. All rights reserved.