管理 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
自定义属性中所指定)。
-priority
- 在 VM 至少打开电源一次之前,磁盘不存在。 因此,您无法在首次打开 VM 电源时更改存储类型。
- 将存储类型更改为较低层后,虚拟机可能需要更长的时间才能启动。
要求
- 适用于托管磁盘。 这意味着您将自定义属性
UseManagedDisks
设置为 true。 - 适用于具有永久操作系统磁盘的永久和非永久目录。 这意味着您将自定义属性
persistOsDisk
设置为 true。 - 适用于具有永久 WBC 磁盘的非永久目录。 这意味着您将自定义属性
persistWBC
设置为 true。
限制
- 根据 Microsoft 的说法,您每天只能更改两次磁盘类型。 请参阅 Microsoft 文档。 根据 Citrix 的说法,每当 VM 执行“启动”或“取消分配”操作时,就会进行
StorageType
更新。 因此,请将每个 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-->
注意:
使用计算机配置文件时,自定义属性优先于
机器配置文件
. - 关闭 VM 并在 Azure 门户中检查 VM 的存储类型。 磁盘的存储类型更改为较低的层,如
StorageTypeAtShutdown
自定义属性中所指定。 - 打开 VM。 磁盘的存储类型切换回下面提及的存储类型:
- 操作系统磁盘的
StorageType
自定义属性 - 仅当您在
CustomProperties
中指定了 WBC 磁盘的WBCDiskStorageType
自定义属性时。 否则,它会切换回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 目录转换为基于计算机配置文件的目录
要将非基于计算机配置文件的计算机目录转换为基于计算机配置文件的计算机目录,请完成以下步骤:
- 在 计算机目录 页面上,右键单击 计算机目录 name (名称),然后选择 编辑计算机目录.
- 在 编辑计算机目录 > 机器简介 页面上,选择 使用计算机配置文件(对于 Azure Active Directory 是必需的) 复选框。
- 点击 选择计算机配置文件.
- 在 选择计算机配置文件 页面上,选择要用作计算机配置文件的虚拟机或启动模板。
- 如果某些当前设置与新的计算机配置文件设置不同,请为要使用的设置选择所需的选项,然后单击 继续.
- 单击应用。
将预配的计算机更新为当前预配方案状态
Set-ProvScheme
命令更改了预配方案。 但是,它不会影响现有计算机。 可以使用 PowerShell 命令 Set-ProvVMUpdateTimeWindow
将当前的预配方案应用到现有的永久计算机或非永久计算机或者一组计算机。 您还可以为现有 MCS 已配置计算机的配置更新安排一个时段。 在安排的时段内打开电源或重新启动都会对计算机应用安排的预配方案更新。 目前,在 Azure 中,您可以更新 服务产品
, 机器配置文件
和以下自定义属性:
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
注意:
现有计算机的操作系统磁盘及其所有数据保持原样,新的 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
表示计划的开始时间为当前时间。 - 使用负数(例如 —1)的
DurationInMinutes
表示计划的时间范围没有上限。
-
-
查找已安排更新的计算机。 例如,
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
命令创建具有不同于主映像 DES 的磁盘加密集 (DES) 的 MCS 计算机目录。 例如:$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 计算机目录和现有虚拟机的磁盘加密类型从一个 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-->
-
更新以前未启用 CMEK 的 MCS 计算机目录和虚拟机,使其具有客户管理的加密密钥 (CMEK) 加密 (DES)、主机磁盘加密或使用
Set-ProvScheme
和Set-ProvVMUpdateTimeWindow
命令进行双重加密。 有关不同加密类型的信息,请参阅 Azure 服务器端加密、主机上的 Azure 磁盘加密和托管磁盘上的双重加密。 -
将之前使用
Set-ProvScheme
和Set-ProvVMUpdateTimeWindow
命令加密的现有 MCS 计算机目录和虚拟机更新为未加密状态。 例如:$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
更新目录。注意:
可以通过
CustomProperties
或MachineProfile
配置DiskEcryptionSetId
。 当它在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 的磁盘上更新后的磁盘加密。
-
在添加新的目录虚拟机之前,运行
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。注意:
可以通过
CustomProperties
或MachineProfile
配置DiskEcryptionSetId
。使用
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
和使用WriteBackCache
已启用。 - 临时 OS 磁盘未启用。
- WBC 是非持久性的:
持续白细胞
是假
. -
UseTempDiskForWBC
为 null 或 false。 - 临时磁盘大小必须大于总大小(回写式缓存磁盘大小 + 分页文件预留空间 + 1 GB 缓冲区空间)。
-priority
不允许将服务产品从具有临时磁盘的服务产品更改为没有临时磁盘的服务产品,反之亦然。
更新现有目录
要更新现有目录,请运行以下命令:
-
跑
Set-ProvScheme
在现有目录上更新UseTempDiskForWBC
自真
. 例如: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、快照、操作系统磁盘和库映像定义的信息
可以显示 Azure VM 的信息,包括操作系统磁盘和类型、快照和库映像定义。 分配计算机目录时,将为主映像上的资源显示此信息。 使用此功能可以查看和选择 Linux 或 Windows 映像。 PowerShell 属性 TemplateIsWindowsTemplate
已添加到 AdditionDatafield
参数中。 此字段包含 Azure 特定的信息:VM 类型、操作系统磁盘、库映像信息和操作系统类型信息。 设置 TemplateIsWindowsTemplate
自 真 表示 OS 类型为 Windows,并且 TemplateIsWindowsTemplate
自 假 表示操作系统类型为 Linux。
提示:
TemplateIsWindowsTemplate
PowerShell 属性显示的信息来自 Azure API。 有时,此字段可能为空。 例如,数据磁盘中的快照不包含TemplateIsWindowsTemplate
字段,因为无法从快照中检索操作系统类型。
例如,使用 PowerShell 将 Windows 操作系统类型的 Azure VM AdditionData
参数设置为 True:
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 模板的区域名称信息。 分配计算机目录后,将为主映像上的资源显示此信息。 当您使用 AdditionalData
参数运行 PowerShell 命令时,名为的 PowerShell 属性 RegionName
会显示区域名称信息。
例如,使用以下 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” | |
操作系统磁盘 | “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 标记以将某个 VM 标识为 MCS 创建的资源,该 VM 在 Citrix 清单中将不可见。 您可以删除或重命名该标记以使其可见。
删除标记
创建目录或 VM 时,将在以下资源上创建标记:
- 资源组
- 虚拟机
- 操作系统磁盘
- 身份磁盘
- 网络接口
- 存储帐户
您可以从 Citrix 数据库中删除 VM 和计算机目录并删除标记。 可以使用以下图标:
- 带
ForgetVM
参数的Remove-ProvVM
从单个虚拟机或计算机目录中的虚拟机列表中删除虚拟机和标签。 - 带
ForgetVM
参数的Remove-ProvScheme
从 Citrix 数据库中删除计算机目录和从整个计算机目录中删除标签。
此功能仅适用于永久 VM。
为此,您需要:
- 打开 PowerShell 窗口。
- 运行 asnp citrix* 以加载特定于 Citrix 的 PowerShell 模块。
-
运行
Remove-ProvVM
从 Citrix 数据库中删除虚拟机和从虚拟机中删除标签。 例如:Remove-ProvVM -ProvisioningSchemeName “ProvisioningSchemeName” -VMName “vmname” -ForgetVM <!--NeedCopy-->
-
运行
Remove-ProvScheme
从 Citrix 数据库中删除计算机目录并从计算机目录中删除标签。 例如:Remove-ProvScheme -ProvisioningSchemeName “ProvisioningSchemeName” -ForgetVM <!--NeedCopy-->
注意:
在
Remove-ProvScheme
中使用ForgetVM
参数后,如果自带资源组 (BYORG) 或 Citrix 托管资源组中存在配置方案,则 MCS 会删除包括基础磁盘快照在内的所有快照。