连接到 Google Cloud 环境
创建和管理连接和资源 介绍了创建连接的向导。以下信息涵盖了 Google Cloud 环境的特定详细信息。
注意:
在创建到 Google Cloud 环境的连接之前,您需要首先将 Google Cloud 帐户设置为资源位置。请参阅 Google Cloud 环境。
添加连接
请按照 创建连接和资源 中的指导进行操作。以下说明将指导您设置托管连接:
-
从 管理 > 配置 中,在左侧窗格中选择 托管。
-
在操作栏中选择 添加连接和资源。
-
在 连接 页面上,选择 创建新连接 和 Citrix Provisioning™ 工具,然后选择 下一步。
- 连接类型。从菜单中选择 Google Cloud。
- 连接名称。键入连接的名称。
-
在 区域 页面上,从菜单中选择一个项目名称,选择包含要使用的资源的区域,然后选择 下一步。
-
在 网络 页面上,键入资源的名称,从菜单中选择一个虚拟网络,选择一个子网,然后选择 下一步。资源名称有助于识别区域和网络组合。名称后附加 (Shared) 后缀的虚拟网络表示共享 VPC。如果为共享 VPC 配置了子网级 IAM 角色,则共享 VPC 的特定子网才会显示在子网列表中。
注意:
- 资源名称可以包含 1–64 个字符,并且不能只包含空格或字符
\ / ; : # . * ? = < > | [ ] { } " ' ( ) ' )。
- 资源名称可以包含 1–64 个字符,并且不能只包含空格或字符
-
在 摘要 页面上,确认信息,然后选择 完成 以退出 添加连接和资源 窗口。
创建连接和资源后,将列出您创建的连接和资源。要配置连接,请选择该连接,然后在操作栏中选择适用的选项。
同样,您可以删除、重命名或测试在连接下创建的资源。为此,请选择连接下的资源,然后在操作栏中选择适用的选项。
服务端点 URL
您必须能够访问以下 URL:
https://oauth2.googleapis.comhttps://cloudresourcemanager.googleapis.comhttps://compute.googleapis.comhttps://storage.googleapis.comhttps://cloudbuild.googleapis.com
Google Cloud 项目
Google Cloud 项目主要有两种类型:
- 预配项目:在这种情况下,当前管理员帐户拥有项目中预配的计算机。此项目也称为本地项目。
- 共享 VPC 项目:在此项目中,在预配项目中创建的计算机使用共享 VPC 项目中的 VPC。用于预配项目的管理员帐户在此项目中具有有限的权限,具体来说,仅具有使用 VPC 的权限。
为 GCP 托管流量创建安全环境
您可以允许私有 Google 访问您的 Google Cloud 项目。此实施可增强安全性以处理敏感数据。为此,您可以执行以下操作之一:
-
为 Cloud Build 服务帐户包含 VPC 服务控制的以下入站规则。如果执行此步骤,则无需遵循以下步骤来为 GCP 托管流量创建安全环境。
Ingress Rule 1 From: Identities: <ProjectID>@cloudbuild.gserviceaccount.com Source > All sources allowed To: Projects = All projects Services = Service name: All services <!--NeedCopy--> -
如果您正在使用专用工作池,请在
CustomProperties中添加UsePrivateWorkerPool。有关专用工作池的信息,请参阅 专用池概述。
创建 GCP 托管流量安全环境的要求
创建 GCP 托管流量安全环境的要求如下:
- 更新自定义属性时,请确保托管连接处于维护模式。
- 要使用专用工作池,需要进行以下更改:
- 对于 Citrix Cloud™ 服务帐户,添加以下 IAM 角色:
- Cloud Build Service Account
- Compute Instance Admin
- Service Account User
- Service Account Token Creator
- Cloud Build WorkerPool Owner
- 在用于创建托管连接的同一项目中创建 Citrix Cloud 服务帐户。
-
按照 DNS 配置 中的说明,为
private.googleapis.com和gcr.io设置 DNS 区域。

-
设置专用网络地址转换 (NAT) 或使用专用服务连接。有关详细信息,请参阅 通过端点访问 Google API。

-
如果使用对等 VPC,请创建 Cloud DNS 区域对等互连到对等 VPC。有关详细信息,请参阅 创建对等互连区域。

-
在 VPC 服务控制中,设置出站规则,以便 API 和 VM 可以与 Internet 通信。入站规则是可选的。例如:
Egress Rule 1 From: Identities:ANY_IDENTITY To: Projects = All projects Service = Service name: All services <!--NeedCopy-->
- 对于 Citrix Cloud™ 服务帐户,添加以下 IAM 角色:
启用专用工作池
要在主机连接上启用专用工作池,请按如下方式设置自定义属性:
- 从 Delivery Controller 主机打开 PowerShell 窗口或使用远程 PowerShell SDK。有关远程 PowerShell SDK 的详细信息,请参阅 SDK 和 API。
-
运行以下命令:
Add-PSSnapin citrix®*cd XDHyp:\Connections\dir
- 将连接中的
CustomProperties复制到记事本。 -
追加属性设置
<Property xsi:type="StringProperty" Name="UsePrivateWorkerPool" Value="True"/>。例如:``` <CustomProperties xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.citrix.com/2014/xd/machinecreation"> <Property xsi:type="StringProperty" Name="UsePrivateWorkerPool" Value="True"/> </CustomProperties> <!--NeedCopy--> ``` - 在 PowerShell 窗口中,将变量分配给修改后的自定义属性。例如:
$customProperty = '<CustomProperties…</CustomProperties>'。 - 运行
$gcpServiceAccount = "<ENTER YOUR SERVICE ACCOUNT EMAIL HERE>". - 运行
$gcpPrivateKey = "<ENTER YOUR SERVICE ACCOUNT PRIVATE KEY HERE AFTER REMOVING ALL INSTANCES OF \n >". - 运行
$securePassword = ConvertTo-SecureString $gcpPrivateKey -AsPlainText -Force. -
运行以下命令以更新现有主机连接:
Set-Item -PassThru -Path @('XDHyp:\\Connections\\<ENTER YOUR CONNECTION NAME HERE>') -SecurePassword $securePassword -UserName $gcpServiceAccount -CustomProperties $customProperty <!--NeedCopy-->
指定 CMEK 全局和区域密钥
注意:
GCP 中对 CMEK 的支持目前处于预览阶段。
GCP 中有两种类型的客户管理加密密钥 (CMEK):
- 区域:只能由同一区域中的资源使用的加密密钥。
- 全局:可由多个区域中的资源使用的加密密钥。
您可以从服务帐户可访问的所有项目中浏览和使用全局或区域客户管理加密密钥 (CMEK)。然后,您可以使用该密钥创建启用 CMEK 的 MCS 计算机目录,并使用 Set-ProvScheme 命令更新现有启用 CMEK 的 MCS 计算机目录。有关使用 PowerShell 创建启用 CMEK 的目录的信息,请参阅 使用自定义属性创建启用 CMEK 的目录。
对于此功能,您需要为以下两个服务帐户提供额外的权限:
- 创建托管连接的当前项目的服务帐户。
- 当前项目的 Compute Engine 服务代理(其电子邮件为:
service-PROJECT_NUMBER@compute-system.iam.gserviceaccount.com)。有关详细信息,请参阅 Compute Engine 服务帐户。
在服务帐户中,您必须在包含要使用的加密密钥的项目(例如,共享项目)中分配以下角色:
- Cloud KMS Viewer
- Cloud KMS CryptoKey Encrypter/Decrypter
如果您未分配这些角色,请确保您具有以下权限:
- resourcemanager.projects.get
- cloudkms.keyRings.list
- cloudkms.keyRings.get
- cloudkms.cryptoKeys.get
- cloudkms.cryptoKeys.list
- cloudkms.cryptoKeyVersions.useToDecrypt
- cloudkms.cryptoKeyVersions.useToEncrypt
列出加密密钥
您可以使用 PowerShell 命令列出同一项目和所有其他可访问项目中的全局和区域加密密钥。为此,请执行以下操作:
- 从 Delivery Controller™ 主机或远程 PowerShell 打开 PowerShell 窗口。
- 运行命令
asnp citrix*以加载 Citrix 特定 PowerShell 模块。 -
运行以下命令以列出加密密钥。示例:
-
要列出
encryptionKeys文件夹的内容:Get-ChildItem XDHyp:\HostingUnits\my-hostingunit\encryptionKeys.folder <!--NeedCopy--> -
要获取同一项目中的全局加密密钥:
Get-Item XDHyp:\HostingUnits\my-hostingunit\encryptionKeys.folder\myglobalkeyring.globalkeyring\myglobalkey.cryptokey <!--NeedCopy-->
-
-
在同一项目中获取区域加密密钥:
Get-Item XDHyp:\HostingUnits\my-hostingunit\encryptionKeys.folder\regional-ring.keyring\shared-key.cryptokey <!--NeedCopy--> -
从另一个可访问的项目(例如:myanotherproject)获取全局加密密钥:
Get-Item XDHyp:\HostingUnits\my-hostingunit\encryptionKeys.folder\myanotherproject.project\shared-global-ring.globalkeyring\shared-key.cryptokey <!--NeedCopy--> -
从另一个可访问的项目(例如:myanotherproject)获取区域加密密钥:
Get-Item XDHyp:\HostingUnits\my-hostingunit\encryptionKeys.folder\myanotherproject .project.project\shared-uscentral.keyring\shared-uscentral-key.cryptokey <!--NeedCopy-->
注意:
- 全局密钥环的密钥环清单项的扩展名为
.globalkeyring。- 全局密钥环的 ID 中包含
global一词。
所需的 GCP 权限
本部分包含 GCP 权限的完整列表。请使用本节中提供的完整权限集,以确保功能正常运行。
注意:
GCP 正在引入对 Cloud Build Services 默认行为和服务帐户使用方式的更改,这些更改将于 2024 年 4 月 29 日之后生效。有关详细信息,请参阅 Cloud Build 服务帐户更改。在 2024 年 4 月 29 日之前启用了 Cloud Build API 的现有 Google 项目不受此更改的影响。但是,如果您希望在 4 月 29 日之后仍保留现有的 Cloud Build Service 行为,则可以在启用 API 之前创建或应用组织策略以禁用约束强制执行。如果您设置了新的组织策略,则仍可以遵循本节中的现有权限以及标记为 Before Cloud Build Service Account Change 的项目。如果未设置,则遵循现有权限以及标记为 After Cloud Build Service Account Change 的项目。
创建主机连接
-
Citrix Cloud Service Account 在预配项目中的最低所需权限:
compute.instanceTemplates.list compute.instances.list compute.networks.list compute.projects.get compute.regions.list compute.subnetworks.list compute.zones.list resourcemanager.projects.get <!--NeedCopy-->以下 Google 定义的角色具有上述权限:
- Compute Admin
- Cloud Datastore User
-
Citrix Cloud Service Account 在共享 VPC 项目中用于共享 VPC 的其他所需权限:
compute.networks.list compute.subnetworks.list resourcemanager.projects.get <!--NeedCopy-->以下 Google 定义的角色具有上述权限:
- Compute Network User
-
在服务帐户中,您必须在包含要使用的加密密钥的项目(例如,共享项目)中分配以下角色:
- Cloud KMS Viewer
- Cloud KMS CryptoKey Encrypter/Decrypter
如果您未分配这些角色,请确保您具有以下权限:
- resourcemanager.projects.get
- cloudkms.keyRings.list
- cloudkms.keyRings.get
- cloudkms.cryptoKeys.get
- cloudkms.cryptoKeys.list
- cloudkms.cryptoKeyVersions.useToDecrypt
- cloudkms.cryptoKeyVersions.useToEncrypt
虚拟机电源管理
Citrix Cloud Service Account 在预配项目中用于仅电源管理目录的最低所需权限:
compute.instanceTemplates.list
compute.instances.list
compute.instances.get
compute.instances.reset
compute.instances.resume
compute.instances.start
compute.instances.stop
compute.instances.suspend
compute.networks.list
compute.projects.get
compute.regions.list
compute.subnetworks.list
compute.zones.list
resourcemanager.projects.get
compute.zoneOperations.get
<!--NeedCopy-->
以下 Google 定义的角色具有上述权限:
- Compute Admin
- Cloud Datastore User
创建、更新或删除虚拟机
-
Citrix Cloud Service Account 在预配项目中的最低所需权限:
cloudbuild.builds.create cloudbuild.builds.get cloudbuild.builds.list compute.acceleratorTypes.list compute.diskTypes.get compute.diskTypes.list compute.disks.create compute.disks.createSnapshot compute.disks.delete compute.disks.get compute.disks.list compute.disks.setLabels compute.disks.use compute.disks.useReadOnly compute.firewalls.create compute.firewalls.delete compute.firewalls.list compute.globalOperations.get compute.images.create compute.images.delete compute.images.get compute.images.list compute.images.setLabels compute.images.useReadOnly compute.instanceTemplates.create compute.instanceTemplates.delete compute.instanceTemplates.get compute.instanceTemplates.list compute.instanceTemplates.useReadOnly compute.instances.attachDisk compute.instances.create compute.instances.delete compute.instances.detachDisk compute.instances.get compute.instances.getSerialPortOutput compute.instances.list compute.instances.reset compute.instances.resume compute.instances.setDeletionProtection compute.instances.setLabels compute.instances.setMetadata compute.instances.setServiceAccount compute.instances.setTags compute.instances.start compute.instances.stop compute.instances.suspend compute.machineTypes.get compute.machineTypes.list compute.networks.list compute.networks.updatePolicy compute.nodeGroups.list compute.nodeTemplates.get compute.projects.get compute.regions.list compute.snapshots.create compute.snapshots.delete compute.snapshots.list compute.snapshots.get compute.snapshots.setLabels compute.snapshots.useReadOnly compute.subnetworks.get compute.subnetworks.list compute.subnetworks.use compute.zoneOperations.get compute.zoneOperations.list compute.zones.get compute.zones.list iam.serviceAccounts.actAs resourcemanager.projects.get storage.buckets.create storage.buckets.delete storage.buckets.get storage.buckets.list storage.buckets.update storage.objects.create storage.objects.delete storage.objects.get storage.objects.list compute.networks.get compute.resourcePolicies.use <!--NeedCopy-->以下 Google 定义的角色具有上述权限:
- Compute Admin
- Storage Admin
- Cloud Build Editor
- Service Account User
- Cloud Datastore User
-
Citrix Cloud Service Account 在共享 VPC 项目中用于共享 VPC 的其他所需权限,以便使用共享 VPC 项目中的 VPC 和子网创建托管单元:
compute.firewalls.list compute.networks.list compute.projects.get compute.regions.list compute.subnetworks.get compute.subnetworks.list compute.subnetworks.use compute.zones.list resourcemanager.projects.get <!--NeedCopy-->以下 Google 定义的角色具有上述权限:
- Compute Network User
- Cloud Datastore User
将准备说明磁盘下载到 MCS 时所需的最低权限:
- (Cloud Build Service Account 更改之前):将这些权限分配给预配项目中的 Cloud Build Service Account。
- (Cloud Build Service Account 更改之后):将这些权限分配给预配项目中的 Cloud Compute Service Account。
compute.disks.create compute.disks.delete compute.disks.get compute.disks.list compute.disks.setLabels compute.disks.use compute.disks.useReadOnly compute.images.get compute.images.list compute.images.useReadOnly compute.instances.create compute.instances.delete compute.instances.get compute.instances.getSerialPortOutput compute.instances.list compute.instances.setLabels compute.instances.setMetadata compute.instances.setServiceAccount compute.machineTypes.list compute.networks.get compute.networks.list compute.projects.get compute.subnetworks.list compute.subnetworks.use compute.subnetworks.useExternalIp compute.zoneOperations.get compute.zones.list iam.serviceAccounts.actAs logging.logEntries.create pubsub.topics.publish resourcemanager.projects.get source.repos.get source.repos.list storage.buckets.create storage.buckets.get storage.buckets.list storage.objects.create storage.objects.delete storage.objects.get storage.objects.list <!--NeedCopy-->以下 Google 定义的角色具有上述权限:
- Cloud Build Service Account(Cloud Build Service Account 更改后,为 Cloud Compute Service Account)
- Compute Instance Admin
- Service Account User
-
Google Cloud Build 服务将准备说明磁盘下载到 MCS 时,Cloud Compute Service Account 在预配项目中所需的最低权限:
resourcemanager.projects.get storage.objects.create storage.objects.get storage.objects.list <!--NeedCopy-->以下 Google 定义的角色具有上述权限:
- Compute Network User
- Storage Account User
- Cloud Datastore User
将准备说明磁盘下载到 MCS 时,共享 VPC 所需的其他权限:
- (Cloud Build Service Account 更改之前):将这些权限分配给预配项目中的 Cloud Build Service Account。
- (Cloud Build Service Account 更改之后):将这些权限分配给预配项目中的 Cloud Compute Service Account。
compute.firewalls.list compute.networks.list compute.subnetworks.list compute.subnetworks.use resourcemanager.projects.get <!--NeedCopy-->以下 Google 定义的角色具有上述权限:
- Compute Network User
- Storage Account User
- Cloud Datastore User
-
Citrix Cloud Service Account 在预配项目中用于 Cloud Key Management Service (KMS) 的其他所需权限:
cloudkms.cryptoKeys.get cloudkms.cryptoKeys.list cloudkms.keyRings.get cloudkms.keyRings.list <!--NeedCopy-->以下 Google 定义的角色具有上述权限:
- Compute KMS Viewer
一般权限
以下是 Citrix Cloud Service Account 在预配项目中用于 MCS 支持的所有功能的权限。这些权限提供了最佳的未来兼容性:
resourcemanager.projects.get
cloudbuild.builds.create
cloudbuild.builds.get
cloudbuild.builds.list
compute.acceleratorTypes.list
compute.diskTypes.get
compute.diskTypes.list
compute.disks.create
compute.disks.createSnapshot
compute.disks.delete
compute.disks.get
compute.disks.setLabels
compute.disks.use
compute.disks.useReadOnly
compute.firewalls.create
compute.firewalls.delete
compute.firewalls.list
compute.globalOperations.get
compute.images.create
compute.images.delete
compute.images.get
compute.images.list
compute.images.setLabels
compute.images.useReadOnly
compute.instanceTemplates.create
compute.instanceTemplates.delete
compute.instanceTemplates.get
compute.instanceTemplates.list
compute.instanceTemplates.useReadOnly
compute.instances.attachDisk
compute.instances.create
compute.instances.delete
compute.instances.detachDisk
compute.instances.get
compute.instances.getSerialPortOutput
compute.instances.list
compute.instances.reset
compute.instances.resume
compute.instances.setDeletionProtection
compute.instances.setLabels
compute.instances.setMetadata
compute.instances.setServiceAccount
compute.instances.setTags
compute.instances.start
compute.instances.stop
compute.instances.suspend
compute.instances.update
compute.instances.updateAccessConfig
compute.instances.updateDisplayDevice
compute.instances.updateSecurity
compute.instances.updateShieldedInstanceConfig
compute.instances.updateShieldedVmConfig
compute.machineTypes.get
compute.machineTypes.list
compute.networks.list
compute.networks.updatePolicy
compute.nodeGroups.list
compute.nodeTemplates.get
compute.projects.get
compute.regions.list
compute.snapshots.create
compute.snapshots.delete
compute.snapshots.list
compute.snapshots.get
compute.snapshots.setLabels
compute.snapshots.useReadOnly
compute.subnetworks.get
compute.subnetworks.list
compute.subnetworks.use
compute.subnetworks.useExternalIp
compute.zoneOperations.get
compute.zoneOperations.list
compute.zones.get
compute.zones.list
resourcemanager.projects.get
storage.buckets.create
storage.buckets.delete
storage.buckets.get
storage.buckets.list
storage.buckets.update
storage.objects.create
storage.objects.delete
storage.objects.get
storage.objects.list
cloudkms.cryptoKeys.get
cloudkms.cryptoKeys.list
cloudkms.keyRings.get
cloudkms.keyRings.list
compute.disks.list
compute.instances.setServiceAccount
compute.networks.get
compute.networks.use
compute.networks.useExternalIp
iam.serviceAccounts.actAs
compute.resourcePolicies.use
cloudkms.cryptoKeyVersions.useToDecrypt
cloudkms.cryptoKeyVersions.useToEncrypt
<!--NeedCopy-->
后续步骤
- 如果您处于初始部署过程中,请参阅 创建计算机目录
- 有关 Google Cloud Platform (GCP) 的特定信息,请参阅 创建 Google Cloud Platform 目录