管理 Microsoft Azure 目录
注意:
自 2023 年 7 月起,Microsoft 已将 Azure Active Directory (Azure AD) 重命名为 Microsoft Entra ID。本文档中,任何提及 Azure Active Directory、Azure AD 或 AAD 的地方均指 Microsoft Entra ID。
管理计算机目录 介绍了用于管理计算机目录的向导。以下信息涵盖了 Microsoft Azure Resource Manager 云环境特有的详细信息。
注意:
在管理 Microsoft Azure 目录之前,您需要完成 Microsoft Azure 目录的创建。请参阅 创建 Microsoft Azure 目录。
当 VM 关闭时将存储类型更改为较低层
当您关闭 VM 时,可以通过将托管磁盘的存储类型切换到较低层来节省存储成本。为此,请使用 StorageTypeAtShutdown
自定义属性。
当您关闭 VM 时,磁盘的存储类型会更改为较低层(如 StorageTypeAtShutdown
自定义属性中所指定)。在您启动 VM 后,存储类型会恢复为原始类型(如 StorageType
自定义属性或 WBCDiskStorageType
自定义属性中所指定)。
重要:
- 磁盘在 VM 至少启动一次后才存在。因此,首次启动 VM 时无法更改存储类型。
- 将存储类型更改为较低层后,VM 启动可能需要稍长的时间。
要求
- 适用于托管磁盘。这意味着您将自定义属性
UseManagedDisks
设置为 true。 - 适用于具有持久 OS 磁盘的持久和非持久目录。这意味着您将自定义属性
persistOsDisk
设置为 true。 - 适用于具有持久 WBC 磁盘的非持久目录。这意味着您将自定义属性
persistWBC
设置为 true。
限制
根据 Microsoft 的规定,您每天只能更改磁盘类型两次。请参阅 Microsoft 文档。根据 Citrix 的规定,StorageType
更新会在 VM 启动或解除分配时发生。因此,将每个 VM 的电源操作次数限制为每天两次。例如,早上一次电源操作以启动 VM,晚上一次以解除分配 VM。
将存储类型更改为较低层
-
添加自定义属性
StorageTypeAtShutdown
,将其值设置为 Standard_LRS (HDD),然后使用New-ProvScheme
创建目录。注意:
如果
StorageTypeAtShutdown
的值不是空值或 Standard_LRS (HDD),则操作失败。创建持久目录时设置自定义属性的示例:
$customProperties='<CustomProperties xmlns="http://schemas.citrix.com/2014/xd/machinecreation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Property xsi:type="StringProperty" Name="UseManagedDisks" Value="true" /> <Property xsi:type="StringProperty" Name="StorageType" Value="Premium_LRS“ /> <Property xsi:type="StringProperty" Name="ResourceGroups" Value="" /> <Property xsi:type="StringProperty" Name="LicenseType" Value="Windows_Client" /> <Property xsi:type="StringProperty" Name="SchemaVersion" Value="2" /> <Property xsi:type="StringProperty" Name="OsType" Value="Windows" /> <Property xsi:type="StringProperty" Name="StorageTypeAtShutdown" Value="Standard_LRS" /> </CustomProperties>’ <!--NeedCopy-->
创建非持久目录时设置自定义属性的示例:
$customProperties='<CustomProperties xmlns="http://schemas.citrix.com/2014/xd/machinecreation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Property xsi:type="StringProperty" Name="UseManagedDisks" Value="true" /> <Property xsi:type="StringProperty" Name="StorageType" Value="Premium_LRS" /> <Property xsi:type="StringProperty" Name="WbcDiskStorageType" Value="Standard_SSD_LRS" /> <Property xsi:type="StringProperty" Name="ResourceGroups" Value="" /> <Property xsi:type="StringProperty" Name="LicenseType" Value="Windows_Client" /> <Property xsi:type="StringProperty" Name="SchemaVersion" Value="2" /> <Property xsi:type="StringProperty" Name="OsType" Value="Windows" /> <Property xsi:type="BooleanProperty" Name="persistWBC" Value=true /> <Property xsi:type="BooleanProperty" Name="persistOsDisk" Value=true /> <Property xsi:type="StringProperty" Name="StorageTypeAtShutdown" Value="Standard_LRS" /> </CustomProperties>’ <!--NeedCopy-->
注意:
当您使用计算机配置文件时,自定义属性优先于
MachineProfile
中定义的属性。 - 关闭 VM 并在 Azure 门户中检查 VM 的存储类型。磁盘的存储类型会更改为较低层,如
StorageTypeAtShutdown
自定义属性中所指定。 - 启动 VM。磁盘的存储类型会切换回以下存储类型:
-
StorageType
自定义属性(用于 OS 磁盘) -
WBCDiskStorageType
自定义属性(仅当您在CustomProperties
中指定时用于 WBC 磁盘)。否则,它会切换回StorageType
中提及的存储类型。
-
StorageTypeAtShutdown
应用于现有目录
将
使用 Set-ProvScheme
将 StorageTypeAtShutdown
应用于添加到现有目录的新 VM。
将 VM 添加到现有目录时设置自定义属性的示例:
$customProperties='<CustomProperties xmlns="http://schemas.citrix.com/2014/xd/machinecreation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Property xsi:type="StringProperty" Name="UseManagedDisks" Value="true" />
<Property xsi:type="StringProperty" Name="StorageType" Value="Premium_LRS" />
<Property xsi:type="StringProperty" Name="WbcDiskStorageType" Value="Standard_SSD_LRS" />
<Property xsi:type="StringProperty" Name="ResourceGroups" Value="" />
<Property xsi:type="StringProperty" Name="LicenseType" Value="Windows_Client" />
<Property xsi:type="StringProperty" Name="SchemaVersion" Value="2" />
<Property xsi:type="StringProperty" Name="OsType" Value="Windows" />
<Property xsi:type="BooleanProperty" Name="persistWBC" Value=true />
<Property xsi:type="BooleanProperty" Name="persistOsDisk" Value=true />
<Property xsi:type="StringProperty" Name="StorageTypeAtShutdown" Value="Standard_LRS" />
</CustomProperties>’
$ProvScheme = Get-Provscheme -ProvisioningSchemeName $CatalogName
Set-ProvScheme -ProvisioningSchemeName $ProvScheme.ProvisioningSchemeName -CustomProperties $customProperties
<!--NeedCopy-->
在关机时将现有 VM 的存储类型更改为较低层
当 VM 关闭时,您可以通过将现有 VM 的存储类型更改为较低层来节省存储成本。
要在 VM 关闭时将目录中现有计算机的存储类型更改为较低层,请执行以下操作:
- 打开 PowerShell 窗口。
- 运行
asnp citrix®*
以加载 Citrix 特定的 PowerShell 模块。 - 运行
Get-Provscheme -ProvisioningSchemeName $CatalogName
。 -
更改自定义属性字符串。
$customProperties = '<CustomProperties xmlns="http://schemas.citrix.com/2014/xd/machinecreation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Property xsi:type="StringProperty" Name="StorageTypeAtShutdown" Value="Standard_LRS" /> </CustomProperties>' <!--NeedCopy-->
-
更新现有目录的预配方案。此更新适用于运行
Set-ProvScheme
后添加的新 VM。Set-ProvScheme -ProvisioningSchemeName $CatalogName -CustomProperties $customProperties <!--NeedCopy-->
-
更新现有 VM 以启用
StorageTypeAtShutdown
。Set-ProvVMUpdateTimeWindow -ProvisioningSchemeName my-catalog -StartsNow -DurationInMinutes -1 <!--NeedCopy-->
- 下次启动计算机时,计算机的
StorageTypeAtShutdown
属性会更新。存储类型会在下次关机时更改。 -
运行以下命令以查看目录中每个 VM 的
StorageTypeAtShutdown
值。Get-ProvVM -ProvisioningSchemeName <catalog-name> | foreach { $vmName = $_.VMName; $storageTypeAtShutdown = ($_.CustomVmData | ConvertFrom-Json).StorageTypeAtShutdown.DiskStorageAccountType; return New-Object psobject -Property @{ "VMName" = $vmName; "StorageTypeAtShutdown" = $storageTypeAtShutdown } } <!--NeedCopy-->
将 Azure 中的旧版 MCS 目录转换为基于计算机配置文件的目录
要将非基于计算机配置文件的计算机目录转换为基于计算机配置文件的计算机目录,请完成以下步骤:
- 在计算机目录页面上,右键单击要转换的计算机目录名称,然后选择编辑计算机目录。
- 在编辑计算机目录 > 计算机配置文件页面上,选中使用计算机配置文件(Azure Active Directory 必需)复选框。
- 单击选择计算机配置文件。
- 在选择计算机配置文件页面上,选择要用作计算机配置文件的虚拟机或启动模板。
- 如果某些当前设置与新的计算机配置文件设置不同,请选择要使用的设置的所需选项,然后单击继续。
- 单击应用。
将预配的计算机更新到当前预配方案状态
Set-ProvScheme
命令会更改预配方案。但是,它不会影响现有计算机。使用 PowerShell 命令 Set-ProvVMUpdateTimeWindow
,您可以将当前预配方案应用于现有持久或非持久计算机或一组计算机。您还可以为现有 MCS 预配计算机的配置更新安排一个时间段。在计划的时间段内进行的任何启动或重新启动都会将计划的预配方案更新应用于计算机。目前,在 Azure 中,您可以更新 ServiceOffering
、MachineProfile
以及以下自定义属性:
StorageType
WBCDiskStorageType
IdentityDiskStorageType
LicenseType
DedicatedHostGroupId
PersistWBC
PersistOsDisk
PersistVm
注意:
- 在 Azure 环境中,您只能更新使用托管磁盘的目录的
StorageType
、WBCDiskStorageType
和IdentityDiskStorageType
自定义属性。- 如果您运行
Set-ProvVMUpdateTimeWindow
两次,则最近的命令将生效。
您可以更新:
- 单个 VM
- 与预配方案 ID 关联的特定 VM 列表或所有现有 VM
- 与预配方案名称(计算机目录名称)关联的特定 VM 列表或所有现有 VM
对预配方案进行以下更改后,Azure 中的持久目录将重新创建 VM 实例:
- 更改
MachineProfile
- 删除
LicenseType
- 删除
DedicatedHostGroupId
注意:
现有计算机的 OS 磁盘及其所有数据保持不变,并且会将新的 VM 附加到该磁盘。
在更新现有 VM 之前:
-
检查现有计算机的配置。例如,
Get-ProvScheme | select ProvisioningSchemeName, ProvisioningSchemeVersion <!--NeedCopy-->
-
更新预配方案。例如,
-
以 VM 作为计算机配置文件输入:
Set-ProvScheme -ProvisioningSchemeName "my-catalog" -MachineProfile "XDHyp:\HostingUnits\<hosting-unit>\machineprofile.folder\<resource-group>.resourcegroup\<virtual-machine>.vm" <!--NeedCopy-->
-
以模板规范作为计算机配置文件输入:
Set-ProvScheme -ProvisioningSchemeName "my-catalog" -MachineProfile "XDHyp:\HostingUnits\<hosting-unit>\machineprofile.folder\<resource-group>.resourcegroup\<template-spec>.templatespec\<template-spec-version>.templatespecversion" -ServiceOffering "XDHyp:\HostingUnits\<hosting-unit>\serviceoffering.folder\<service-offering>.serviceoffering" <!--NeedCopy-->
-
仅使用服务产品:
Set-ProvScheme -ProvisioningSchemeName "my-catalog" -ServiceOffering "XDHyp:\HostingUnits\<hosting-unit>\serviceoffering.folder\<service-offering>.serviceoffering" <!--NeedCopy-->
-
-
检查 VM 的当前属性是否与当前预配方案匹配,以及 VM 上是否有任何待处理的更新操作。例如,
Get-ProvVM | select VMName, ProvisioningSchemeUpdateRequested, ProvisioningSchemeVersion <!--NeedCopy-->
您还可以查找具有特定版本的计算机。例如,
Get-ProvVM -Filter "ProvisioningSchemeVersion -eq 1" | select VMName, ProvisioningSchemeVersion <!--NeedCopy-->
要请求现有计算机的更新在下次重新启动时应用,请执行以下操作:
-
运行以下命令以更新现有计算机,并使更新在下次重新启动时应用。
-
要更新所有现有计算机。例如,
Set-ProvVMUpdateTimeWindow -ProvisioningSchemeName my-catalog -StartsNow -DurationInMinutes -1 <!--NeedCopy-->
-
要更新特定计算机列表。例如,
Set-ProvVMUpdateTimeWindow -ProvisioningSchemeName my-catalog -VMName <List-Of-Vm-Names> -StartsNow -DurationInMinutes -1 <!--NeedCopy-->
-
要根据 Get-ProvVM 的输出更新计算机。例如,
Get-ProvVM -ProvisioningSchemeName "my-catalog" | Set-ProvVMUpdateTimeWindow -ProvisioningSchemeName my-catalog -StartsNow -DurationInMinutes -1 <!--NeedCopy-->
注意:
-
StartsNow
表示计划的开始时间是当前时间。 -
DurationInMinutes
为负数(例如,–1)表示计划时间窗口没有上限。
-
-
查找已计划更新的计算机。例如,
Get-ProvVM -Filter "ProvisioningSchemeUpdateAfter" | select VMName, ProvisioningSchemeUpdateAfter <!--NeedCopy-->
-
重新启动计算机。下次启动时,属性更改将应用于现有计算机。您可以使用以下命令检查更新状态。例如,
Get-ProvVM | select VMName, ProvisioningSchemeUpdateRequested, ProvisioningSchemeVersion <!--NeedCopy-->
要将 VM 计划为在下次在计划的时间窗口内启动时更新到最新的预配设置,请执行以下操作:
-
运行以下命令:
-
要计划以当前时间为开始时间的更新:
Set-ProvVMUpdateTimeWindow -ProvisioningSchemeName my-catalog -VMName vm1 -StartsNow -DurationInMinutes 120 <!--NeedCopy-->
-
要在周末计划更新:
Set-ProvVMUpdateTimeWindow -ProvisioningSchemeName “ my-catalog “ -VMName “vm1” -StartTimeInUTC “10/15/2022 9:00am” -DurationInMinutes (New –TimeSpan –Days 2).TotalMinutes <!--NeedCopy-->
注意:
-
VMName
是可选的。如果未指定,则为整个目录计划更新。 - 使用
StartsNow
而不是StartTimeInUTC
来指示计划开始时间是当前时间。 -
DurationInMinutes
是可选的。默认值为 120 分钟。负数(例如,–1)表示计划时间窗口没有上限。
-
-
检查更新状态。
Get-ProvVM | select VMName, ProvisioningSchemeUpdateRequested, ProvisioningSchemeUpdateUntil, ProvisioningSchemeVersion <!--NeedCopy-->
-
启动 VM。如果您在计划的时间段之后启动计算机,则不会应用配置更新。如果您在计划的时间段内启动计算机,则:
- 如果计算机已关机,并且
- 您未启动计算机,则不会应用配置更新
- 您启动计算机,则会应用配置更新
- 如果计算机已启动,并且
- 您未重新启动计算机,则不会应用配置更新
- 您重新启动计算机,则会应用配置更新
- 如果计算机已关机,并且
要取消配置更新:
您还可以取消单个 VM、多个 VM 或整个目录的配置更新。要取消配置更新:
-
运行
Clear-ProvVMUpdateTimeWindow
。例如:-
要取消为单个 VM 计划的配置更新:
Clear-ProvVMUpdateTimeWindow -ProvisioningSchemeName “ my-catalog “ -VMName “vm1” <!--NeedCopy-->
-
要取消为多个 VM 计划的配置更新:
Clear-ProvVMUpdateTimeWindow -ProvisioningSchemeName "my-catalog" -VMName "vm1","vm2" <!--NeedCopy-->
-
注意:
VM 必须来自同一目录。
更改磁盘加密
您可以在 Azure 虚拟化环境中更改磁盘加密并执行以下操作:
-
使用
New-ProvScheme
命令创建 MCS 计算机目录,其磁盘加密集 (DES) 与主映像 DES 不同。例如:$customProperties = @" <CustomProperties xmlns="http://schemas.citrix.com/2014/xd/machinecreation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Property xsi:type="DiskEncryptionSetId" Name="Zones" Value="/subscriptions/XXXXXXXXXXXXXXXXXXXXXXXXXXXXX/resourceGroups/testrsg/providers/Microsoft.Compute/diskEncryptionSets/test-diskEncryptionSet"/> </CustomProperties> "@ New-ProvScheme -CleanOnBoot ` -ProvisioningSchemeName $provisioningSchemeName ` -HostingUnitName $hostingUnitName ` -IdentityPoolName $identityPoolName ` -InitialBatchSizeHint $numberOfVms ` -masterImagePath $masterImagePath ` -NetworkMapping $networkMapping ` -CustomProperties $customProperties <!--NeedCopy-->
-
使用
Set-ProvScheme
和Set-ProvVMUpdateTimeWindow
命令将现有 MCS 计算机目录和现有 VM 的磁盘加密类型从一个 DES 密钥更改为另一个 DES 密钥。重新启动 VM 后,您可以看到更新的 DES 密钥。例如:$customProperties = '<CustomProperties xmlns="http://schemas.citrix.com/2014/xd/machinecreation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Property xsi:type="StringProperty" Name="DiskEncryptionSetId" Value="/subscriptions/456c683e2ed7/resourceGroups/testrg/providers/Microsoft.Compute/diskEncryptionSets/diskEncryptionSet1" /> </CustomProperties>' Set-ProvScheme -ProvisioningSchemeName azure-catalog -CustomProperties $customProperties Set-ProvVMUpdateTimeWindow -ProvisioningSchemeName azure-catalog -VMName azu01, azu02 -StartsNow -DurationInMinutes -1 <!--NeedCopy-->
-
使用
Set-ProvScheme
和Set-ProvVMUpdateTimeWindow
命令更新以前未启用 CMEK 的 MCS 计算机目录和 VM,以使其具有客户管理的加密密钥 (CMEK) 加密 (DES)、主机磁盘加密或双重加密。有关不同加密类型的信息,请参阅 Azure 服务器端加密、主机上的 Azure 磁盘加密和托管磁盘上的双重加密。 -
使用
Set-ProvScheme
和Set-ProvVMUpdateTimeWindow
命令更新现有 MCS 计算机目录和 VM,使其从以前的加密状态变为非加密状态。例如:$customProperties = '<CustomProperties xmlns="http://schemas.citrix.com/2014/xd/machinecreation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Property xsi:type="StringProperty" Name="DiskEncryptionSetId" Value="" /> </CustomProperties>' Set-ProvScheme -ProvisioningSchemeName azure-catalog -CustomProperties $customProperties Set-ProvVMUpdateTimeWindow -ProvisioningSchemeName azure-catalog -VMName azu01, azu02 -StartsNow -DurationInMinutes -1 <!--NeedCopy-->
-
启用带专用终结点的磁盘加密(使用启用了
ProxyHypervisorTrafficThroughConnector
的主机连接的 MCS 计算机目录)。有关ProxyHypervisorTrafficThroughConnector
的更多信息,请参阅 为 Azure 托管流量创建安全环境。有关如何启用带专用终结点的磁盘加密的信息,请参阅启用带专用终结点的磁盘加密。
启用带专用终结点的磁盘加密
根据 Azure 的限制,目前,您无法为专用终结点使用客户管理的密钥进行服务器端加密。但是,您可以更新现有 MCS 计算机目录和带专用终结点的 VM,以使用 DES 密钥进行加密。
更新带专用终结点的现有计算机目录
更新带专用终结点的现有计算机目录的详细步骤如下:
- 通过
ProxyHypervisorTrafficThroughConnector
创建不带磁盘加密的目录。有关ProxyHypervisorTrafficThroughConnector
的更多信息,请参阅 为 Azure 托管流量创建安全环境。 -
运行
Set-ProvScheme
以使用DiskEncryptionSetId
更新目录。注意:
DiskEcryptionSetId
可以通过CustomProperties
或MachineProfile
进行配置。当它在CustomProperties
和MachineProfile
中都定义时,将应用CustomProperties
中定义的属性。使用
CustomProperties
时的示例:$customProperties = '<CustomProperties xmlns="http://schemas.citrix.com/2014/xd/machinecreation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Property xsi:type="StringProperty" Name="DiskEncryptionSetId" Value="/subscriptions/456c683e2ed7/resourceGroups/testrg/providers/Microsoft.Compute/diskEncryptionSets/diskEncryptionSet1"/> </CustomProperties>' Set-ProvScheme -ProvisioningSchemeName azure-catalog -CustomProperties $customProperties <!--NeedCopy-->
使用 MachineProfile 时的示例:使用已启用磁盘加密的 VM 或具有磁盘加密设置的模板规范:
Set-ProvScheme -ProvisioningSchemeName azure-catalog -MachineProfile "XDHyp:\HostingUnits\azureunit\machineprofile.folder\testrg.resourcegroup\new-template.vm" <!--NeedCopy-->
或者,您可以使用 Studio 更新计算机配置文件。
-
运行
Set-ProvVMUpdateTimeWindow
以更新现有目录 VM。例如:Set-ProvVMUpdateTimeWindow -ProvisioningSchemeName azure-catalog -VMName azu01, azu02 -StartsNow -DurationInMinutes -1 <!--NeedCopy-->
- 重新启动 VM 后,您可以在 Azure 门户中看到 VM 磁盘上更新的磁盘加密。
-
在添加新的目录 VM 之前,运行
Set-ProvScheme
以取消设置磁盘加密。注意:
此步骤是必需的,因为您正在更新专用终结点目录。如果您不执行此步骤,则在尝试向目录添加新 VM 时会收到错误。
例如:
$customProperties = '<CustomProperties xmlns="http://schemas.citrix.com/2014/xd/machinecreation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Property xsi:type="StringProperty" Name="DiskEncryptionSetId" Value="" /> </CustomProperties>' Set-ProvScheme -ProvisioningSchemeName azure-catalog -CustomProperties $customProperties <!--NeedCopy-->
- 将新 VM 添加到目录。
更新单个目录 VM
更新单个目录 VM 的详细步骤如下:
- 通过
ProxyHypervisorTrafficThroughConnector
创建不带磁盘加密的目录。有关ProxyHypervisorTrafficThroughConnector
的更多信息,请参阅 为 Azure 托管流量创建安全环境。 -
运行
Set-ProvVM
以使用DiskEncryptionSetId
更新目录 VM。注意:
DiskEcryptionSetId
可以通过CustomProperties
或MachineProfile
进行配置。使用
CustomProperties
时的示例:$customProperties = '<CustomProperties xmlns="http://schemas.citrix.com/2014/xd/machinecreation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Property xsi:type="StringProperty" Name="DiskEncryptionSetId" Value="/subscriptions/456c683e2ed7/resourceGroups/testrg/providers/Microsoft.Compute/diskEncryptionSets/diskEncryptionSet1" /> </CustomProperties>' Set-ProvVM -ProvisioningSchemeName azure-catalog -VMName azu01 -CustomProperties $customProperties <!--NeedCopy-->
使用 MachineProfile 时的示例:
Set-ProvVM -ProvisioningSchemeName azure-catalog -VMName azu01 -MachineProfile "XDHyp:\HostingUnits\azureunit\machineprofile.folder\testrg.resourcegroup\new-template.vm" <!--NeedCopy-->
-
运行
Set-ProvVMUpdateTimeWindow
以更新现有目录 VM。例如:Set-ProvVMUpdateTimeWindow -ProvisioningSchemeName azure-catalog -VMName azu01 -StartsNow -DurationInMinutes -1 <!--NeedCopy-->
- 重新启动 VM 后,您可以在 Azure 门户中看到 VM 磁盘上更新的磁盘加密。
- 将新 VM 添加到目录。
将临时磁盘用作现有目录的 WBC 磁盘
您可以将 Azure 临时磁盘用作现有 MCS 计算机目录的回写缓存磁盘 (WBC)。使用 Set-ProvScheme
PowerShell 命令更新现有目录和 VM。
先决条件
现有目录必须满足以下条件:
注意:
如果现有目录不满足以下要求,则 WBC 磁盘不会放置在临时磁盘内。
- MCSIO 已启用:自定义属性
WriteBackCacheMemorySize
、WriteBackCacheDiskSize
和UseWriteBackCache
已启用。 - 未启用临时 OS 磁盘。
- WBC 是非持久的:
PersistWBC
为false
。 -
UseTempDiskForWBC
为 null 或 false。 - 临时磁盘大小必须大于(回写缓存磁盘大小 + 分页文件保留空间 + 1 GB 缓冲区空间)的总和。
重要:
不允许将服务产品从带临时磁盘的更改为不带临时磁盘的,反之亦然。
更新现有目录
要更新现有目录,请运行以下命令:
-
在现有目录上运行
Set-ProvScheme
以将UseTempDiskForWBC
更新为true
。例如:Set-ProvScheme -ProvisioningSchemeName name -CustomProperties "<CustomProperties xmlns=`"http://schemas.citrix.com/2014/xd/machinecreation`" xmlns:xsi=`"http://www.w3.org/2001/XMLSchema-instance`"><Property xsi:type=`"StringProperty`" Name=`"StorageAccountType`" Value=`"Standard_LRS`"/><Property xsi:type=`"StringProperty`" Name=`"UseManagedDisks`" Value=`"True`"/><Property xsi:type=`"StringProperty`" Name=`"ManagedDisksPreview`" Value=`"False`"/><Property xsi:type=`"StringProperty`" Name=`"PersistOsDisk`" Value=`"False`"/><Property xsi:type=`"StringProperty`" Name=`"UseTempDiskForWBC`" Value=`"True`"/><Property xsi:type=`"StringProperty`" Name=`"PersistWBC`" Value=`"False`"/></CustomProperties>" <!--NeedCopy-->
-
将新计算机添加到目录并启动。新 VM 在临时磁盘内具有 WBC 磁盘。
检索 Azure VM、快照、OS 磁盘和库映像定义的信息
您可以显示 Azure VM 的信息,包括 OS 磁盘和类型、快照和库映像定义。当分配计算机目录时,此信息会显示在主映像上的资源中。使用此功能可以查看和选择 Linux 或 Windows 映像。PowerShell 属性 TemplateIsWindowsTemplate
已添加到 AdditionDatafield
参数中。此字段包含 Azure 特定的信息:VM 类型、OS 磁盘、库映像信息和 OS 类型信息。将 TemplateIsWindowsTemplate
设置为 True 表示 OS 类型为 Windows,将其设置为 False 表示 OS 类型为 Linux。
提示:
TemplateIsWindowsTemplate
PowerShell 属性显示的信息源自 Azure API。有时,此字段可能为空。例如,数据磁盘的快照不包含TemplateIsWindowsTemplate
字段,因为无法从快照中检索 OS 类型。
例如,使用 PowerShell 将 Azure VM AdditionData
参数设置为 True 以表示 Windows OS 类型:
PS C:\Users\username> (get-item XDHyp:\HostingUnits\mynetwork\image.folder\username-dev-testing-rg.resourcegroup\username-dev-tsvda.vm).AdditionalData
Key Value
ServiceOfferingDescription Standard_B2ms
HardDiskSizeGB 127
ResourceGroupName FENGHUAJ-DEV-TESTING-RG
ServiceOfferingMemory 8192
ServiceOfferingCores 2
TemplateIsWindowsTemplate True
ServiceOfferingWithTemporaryDiskSizeInMb 16384
SupportedMachineGenerations Gen1,Gen2
<!--NeedCopy-->
检索 Azure VM、托管磁盘、快照、Azure VHD 和 ARM 模板的区域名称信息
您可以显示 Azure VM、托管磁盘、快照、Azure VHD 和 ARM 模板的区域名称信息。当分配计算机目录时,此信息会显示在主映像上的资源中。名为 RegionName
的 PowerShell 属性会在您使用 AdditionalData
参数运行 PowerShell 命令时显示区域名称信息。
例如,使用以下 PowerShell 命令获取 Azure 中的 VM 信息。
PS C:\Windows\system32> (get-item XDHyp:\HostingUnits\myAzureNetwork\image.folder\hu-dev-testing-rg.resourcegroup\hu-dev-tsvda.vm).AdditionalData
Key Value
HardDiskSizeGB 127
ResourceGroupName HU-DEV-TESTING-RG
RegionName East US
TemplateIsWindowsTemplate True
LicenseType
ServiceOfferingDescription Standard_B2ms
ServiceOfferingMemory 8192
ServiceOfferingCores 2
SupportedMachineGenerations Gen1,Gen2
ServiceOfferingWithTemporaryDiskSizeInMb 16384
SecurityType
SecureBootEnabled
VTpmEnabled
<!--NeedCopy-->
识别 MCS 创建的资源
以下是 MCS 添加到 Azure 平台资源的标签。表中的标签表示为“key”:“value”。
资源名称 | 标签 |
---|---|
ID 磁盘 | “CitrixProvisioningSchemeId” : “xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx” |
“CitrixResource” : “Internal” | |
映像 | “CitrixProvisioningSchemeId” : “xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx” |
“CitrixResource” : “Internal” | |
NIC | “CitrixProvisioningSchemeId” : “xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx” |
“CitrixResource” : “Internal” | |
OS 磁盘 | “CitrixProvisioningSchemeId” : “xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx” |
“CitrixResource” : “Internal” | |
准备 VM | “CitrixProvisioningSchemeId” : “xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx” |
“CitrixResource” : “Internal” | |
已发布的快照 | “CitrixProvisioningSchemeId” : “xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx” |
“CitrixResource” : “Internal” | |
资源组 | “CitrixResource” : “Internal” |
CitrixSchemaVersion: 2.0 | |
“CitrixProvisioningSchemeId” : “xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx” | |
存储帐户 | “CitrixProvisioningSchemeId” : “xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx” |
“CitrixResource” : “Internal” | |
目录中的 VM | “CitrixProvisioningSchemeId” : “xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx” |
“CitrixResource” : “Internal” | |
WBC 磁盘 | “CitrixProvisioningSchemeId” : “xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx” |
“CitrixResource” : “Internal” |
注意:
如果添加了 CitrixResource 标签以将其标识为 MCS 创建的资源,则 VM 在 Citrix 清单中不可见。您可以删除或重命名该标签以使其可见。
删除标签
当您创建目录或 VM 时,会在以下资源上创建标签:
- 资源组
- 虚拟机
- OS 磁盘
- 标识磁盘
- 网络接口
- 存储帐户
您可以从 Citrix 数据库中删除 VM 和计算机目录,并删除标签。您可以使用:
- 带
ForgetVM
参数的Remove-ProvVM
,用于从单个 VM 或计算机目录中的 VM 列表中删除 VM 和标签。 - 带
ForgetVM
参数的Remove-ProvScheme
,用于从 Citrix 数据库中删除计算机目录以及从整个计算机目录中删除标签。
此功能仅适用于持久 VM。
为此,请执行以下操作:
- 打开 PowerShell 窗口。
- 运行 asnp citrix* 以加载 Citrix 特定的 PowerShell 模块。
-
运行
Remove-ProvVM
以从 Citrix 数据库中删除 VM 并从 VM 中删除标签。 例如:Remove-ProvVM -ProvisioningSchemeName “ProvisioningSchemeName” -VMName “vmname” -ForgetVM <!--NeedCopy-->
-
运行
Remove-ProvScheme
以从 Citrix 数据库中删除计算机目录并从计算机目录中删除标签。例如:Remove-ProvScheme -ProvisioningSchemeName “ProvisioningSchemeName” -ForgetVM <!--NeedCopy-->
注意:
在
Remove-ProvScheme
中使用ForgetVM
参数后,如果预配方案存在于自带资源组 (BYORG) 或 Citrix 托管资源组中,MCS 将删除所有快照,包括基本磁盘快照。