使用 ARM 模板管理已启用 Entra ID 的 Azure HDInsight 群集

Azure HDInsight 现在支持与 Microsoft Entra ID 集成,为大数据工作负载启用安全、基于角色的访问控制和简化的标识管理。 通过使用 Azure 资源管理器(ARM)模板,可以采用可重复、自动化和一致的方式部署和管理已启用 Entra ID 的 HDInsight 群集。 本指南介绍如何设置 ARM 模板资源并配置 Entra ID。 你还将了解如何在满足组织的安全和治理规则的同时大规模管理群集。

先决条件

在开始之前,请确保具有以下资源:

  • 具有足够权限部署资源的 Azure 订阅。

  • Microsoft Entra ID 租户已配置且可访问。

  • 具有必要角色分配(例如参与者和用户访问管理员)的服务主体或托管身份,以创建和管理 HDInsight 群集。

  • Azure CLI、PowerShell 或 Azure 门户访问权限,用于验证部署并监视群集状态。

  • 定义群集配置和 Entra ID 集成设置的 ARM 模板和参数文件。

ARM 模板资源定义

可以通过面向资源组的操作来部署群集资源类型 - 请参阅资源组部署命令

有关每个 API 版本中已更改属性的列表,请参阅更改日志

资源格式

若要创建 Microsoft.HDInsight/clusters 资源,请将以下 JSON 添加到模板。

				{
					"$schema": "https://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
					"contentVersion": "0.9.0.0",
					"parameters": {
						"clusterName": {
							"type": "string",
							"metadata": {
								"description": "The name of the HDInsight cluster to create."
							}
						},
						"location": {
							"type": "string",
							"defaultValue": "chinaeast2euap",
							"metadata": {
								"description": "The location where all azure resources will be deployed."
							}
						},
						"clusterVersion": {
							"type": "string",
							"defaultValue": "5.1",
							"metadata": {
								"description": "HDInsight cluster version."
							}
						},
						"clusterWorkerNodeCount": {
							"type": "int",
							"defaultValue": 4,
							"metadata": {
								"description": "The number of nodes in the HDInsight cluster."
							}
						},
						"clusterKind": {
							"type": "string",
							"defaultValue": "SPARK",
							"metadata": {
								"description": "The type of the HDInsight cluster to create."
							}
						},
						"sshUserName": {
							"type": "string",
							"defaultValue": "sshuser",
							"metadata": {
								"description": "These credentials can be used to remotely access the cluster."
							}
						},
						"clusterRestAuthEntraUsers": {
							"type": "string",
							"metadata": {
								"description": "These Micrsoft Entra users can be used to submit jobs to the cluster and to log into cluster dashboards."
							}
						},
						"sshPassword": {
							"type": "securestring",
							"metadata": {
								"description": "The password must be at least 10 characters in length and must contain at least one digit, one non-alphanumeric character, and one upper or lower case letter."
							}
						},
						"minTlsVersionNumber": {
							"type": "string"
						},
						"isEncryptionInTransitEnabled": {
							"type": "bool"
						}
					},
					"resources": [
						{
							"apiVersion": "2025-01-15-preview",
							"name": "[parameters('clusterName')]",
							"type": "Microsoft.HDInsight/clusters",
							"location": "[parameters('location')]",
							"dependsOn": [],
							"tags": {},
							"zones": null,
							"properties": {
								"clusterVersion": "[parameters('clusterVersion')]",
								"osType": "Linux",
								"tier": "standard",
								"clusterDefinition": {
									"kind": "[parameters('clusterKind')]",
									"componentVersion": {
										"Spark": "3.3"
									},
									"configurations": {
										"gateway": {
											"restAuthCredential.isEnabled": false,
											"restAuthEntraUsers": "[parameters('clusterRestAuthEntraUsers')]"
										}
									}
								},
								"storageProfile": {
									"storageaccounts": [
										{
											"name": "<storageAccountName>.dfs.core.chinacloudapi.cn",
											"isDefault": true,
											"fileSystem": "hmgespark1-2025-10-06t08-34-17-604z",
											"resourceId": "/subscriptions/SubscriptionID>/resourceGroups/<resourceGroupName>/providers/Microsoft.Storage/storageAccounts/<MSIname>",
											"msiResourceId": "/subscriptions/<SubscriptionID>/resourcegroups/<resourceGroupName>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<MSIname>",
											"enableSecureChannel": true
										}
									]
								},
								"computeProfile": {
									"roles": [
										{
											"autoscale": null,
											"name": "headnode",
											"minInstanceCount": 1,
											"targetInstanceCount": 2,
											"hardwareProfile": {
												"vmSize": "Standard_E8_V3"
											},
											"osProfile": {
												"linuxOperatingSystemProfile": {
													"username": "[parameters('sshUserName')]",
													"password": "[parameters('sshPassword')]"
												},
												"windowsOperatingSystemProfile": null
											},
											"virtualNetworkProfile": null,
											"scriptActions": [],
											"dataDisksGroups": null
										},
										{
											"autoscale": {
												"capacity": {
													"minInstanceCount": 4,
													"maxInstanceCount": 5
												},
												"recurrence": null
											},
											"name": "workernode",
											"targetInstanceCount": 4,
											"hardwareProfile": {
												"vmSize": "Standard_E8_V3"
											},
											"osProfile": {
												"linuxOperatingSystemProfile": {
													"username": "[parameters('sshUserName')]",
													"password": "[parameters('sshPassword')]"
												},
												"windowsOperatingSystemProfile": null
											},
											"virtualNetworkProfile": null,
											"scriptActions": [],
											"dataDisksGroups": null
										},
										{
											"autoscale": null,
											"name": "zookeepernode",
											"minInstanceCount": 1,
											"targetInstanceCount": 3,
											"hardwareProfile": {
												"vmSize": "Standard_A2_V2"
											},
											"osProfile": {
												"linuxOperatingSystemProfile": {
													"username": "[parameters('sshUserName')]",
													"password": "[parameters('sshPassword')]"
												},
												"windowsOperatingSystemProfile": null
											},
											"virtualNetworkProfile": null,
											"scriptActions": [],
											"dataDisksGroups": null
										}
									]
								},
								"minSupportedTlsVersion": "[parameters('minTlsVersionNumber')]",
								"encryptionInTransitProperties": {
									"isEncryptionInTransitEnabled": "[parameters('isEncryptionInTransitEnabled')]"
								}
							},
							"identity": {
								"type": "UserAssigned",
								"userAssignedIdentities": {
									"/subscriptions/<subcriptionID>/resourcegroups/<resourceGroupName>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/<MSIname>": {}
								}
							}
						}
					]
				}

参数

     				{
				  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
				  "contentVersion": "1.0.0.0",
				  "parameters": {
					"clusterName": {
					  "value": "<clustername>"
					},
					"location": {
					  "value": "<region_name>"
					},
					"clusterVersion": {
					  "value": "5.1"
					},
					"clusterWorkerNodeCount": {
					  "value": 4
					},
					"clusterKind": {
					  "value": "SPARK"
					},
					"sshUserName": {
					  "value": "sshuser"
					},
					"clusterRestAuthEntraUsers": {
					  "value": "[{\"displayName\":\"<Name>\",\"objectId\":\"00000000-0000-0000-0000-1ed7871c38e0\",\"upn\":\"user2@contoso.com\"},{\"displayName\":\"<Name>\",\"objectId\":\"00000000-0000-0000-000-b44d6570aa30\",\"upn\":\"user1@contoso.com\"}]"
					},
					"sshPassword": {
					  "value": null
					},
					"minTlsVersionNumber": {
					  "value": "1.2"
					},
					"isEncryptionInTransitEnabled": {
					  "value": true
					}
				  }
				}

属性值

自动缩放

Name Description 价值
产能 基于负载的自动缩放的参数 AutoscaleCapacity
定期 基于计划的自动缩放的参数 AutoscaleRecurrence

AutoscaleCapacity

Name Description 价值
maxInstanceCount 基于计划的自动缩放规则的数组 int
timeZone 自动缩放计划时间的时区 int

AutoscaleRecurrence

Name Description 价值
时间表 基于计划的自动缩放规则的数组 AutoscaleSchedule
timeZone 自动缩放计划时间的时区 字符串

AutoscaleSchedule

Name Description 价值
days 基于计划的自动缩放规则的一周中的天数 包含任意值:“星期五”/“星期一”/“星期六”/“星期日”/“星期四”/“星期二”/“星期三”的字符串数组
timeAndCapacity 基于计划的自动缩放规则的时间和容量 AutoscaleTimeAndCapacity

AutoscaleTimeAndCapacity

Name Description 价值
maxInstanceCount 群集的最大实例计数 int
minInstanceCount 群集的最小实例计数 int
time 24 小时制的 HH:MM 时间格式 字符串

ClusterCreatePropertiesOrClusterGetProperties

Name Description 价值
clusterDefinition 群集定义。 ClusterDefinition
clusterVersion 群集的版本。 字符串
computeIsolationProperties 计算隔离属性。 ComputeIsolationProperties
computeProfile 计算配置文件。 ComputeProfile
diskEncryptionProperties 磁盘加密属性。 DiskEncryptionProperties
encryptionInTransitProperties 传输中加密属性。 EncryptionInTransitProperties
kafkaRestProperties 群集 kafka rest 代理配置。 KafkaRestProperties
minSupportedTlsVersion 支持的最低 TLS 版本。 字符串
networkProperties 网络属性。 NetworkProperties
osType 操作系统的类型。 “Linux”/“Windows”
privateLinkConfigurations 专用链接配置。 PrivateLinkConfiguration[]
securityProfile 安全配置文件。 SecurityProfile
storageProfile 存储配置文件。 StorageProfile
分层 群集层。 “Premium”/“Standard”

ClusterDefinition

Name Description 价值
蓝图 蓝图的链接。 字符串
componentVersion 群集中不同服务的版本。 ClusterDefinitionComponentVersion
配置 群集配置。 any
kind 群集的类型。 字符串

ClusterIdentity

Name Description 价值
类型 用于群集的标识类型。 类型“SystemAssigned ,UserAssigned”包含隐式创建的标识和一组用户分配的标识。 “无”/“SystemAssigned”/“UserAssigned”
userAssignedIdentities 与群集关联的用户标识列表。 用户标识字典键引用是以下形式的 ARM 资源 ID:“/subscriptions/{subscriptionID}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}”。 ClusterIdentityUserAssignedIdentities

ComputeIsolationProperties

Name Description 价值
enableComputeIsolation 该标志指示是否启用计算隔离。 布尔
hostSku 主机 SKU。 字符串

ComputeProfile

Name Description 价值
roles 群集中的角色列表。 角色 []

DataDisksGroups

Name Description 价值
disksPerNode 每个节点的磁盘数。 int

DiskEncryptionProperties

Name Description 价值
encryptionAlgorithm 加密算法标识符,默认 RSA-OAEP。 “RSA-OAEP” “RSA-OAEP-256” “RSA1_5”
encryptionAtHost 指示是否启用资源磁盘加密。 布尔
keyName 用于启用磁盘加密的密钥名称。 字符串
keyVersion 用于启用磁盘加密的特定密钥版本。 字符串
msiResourceId 用于访问密钥保管库的托管标识的资源 ID。 字符串
vaultUri 例如,客户密钥所在的基密钥保管库 URI。 https://myvault.vault.azure.cn 字符串

EncryptionInTransitProperties

Name Description 价值
isEncryptionInTransitEnabled 指示群集节点间通信是否在传输中加密。 布尔

硬件配置文件

Name Description 价值
vmSize 虚拟机的大小 字符串

IP 配置

Name Description 价值
姓名 专用链接 IP 配置的名称。 字符串(必需)
属性 专用链接 IP 配置属性。 IPConfigurationProperties

IPConfigurationProperties

Name Description 价值
首要 指示此 IP 配置是否是相应 NIC 的主要配置。 布尔
privateIPAddress IP 地址。 字符串
privateIPAllocationMethod 分配专用 IP 地址的方法。 “动态” “静态”
子网 子网资源 ID。 ResourceID

IpTag

Name Description 价值
ipTagType 获取或设置 ipTag 类型:示例 FirstPartyUsage。 字符串(必需)
标签 获取或设置与公共 IP 关联的 IpTag 的值。 HDInsight、SQL、存储等示例 字符串(必需)

KafkaRestProperties

Name Description 价值
clientGroupInfo Microsoft Entra ID 安全组的信息。 ClientGroupInfo
configurationOverride 需要重写的配置。 KafkaRestPropertiesConfigurationOverride

LinuxOperatingSystemProfile

Name Description 价值
密码 密码。 字符串
sshProfile SSH 配置文件。 SshProfile
用户名 用户名。 字符串

Microsoft.HDInsight/clusters

Name Description 价值
apiVersion API 版本。 '2025-01-15-preview'
标识 群集的标识(如果已配置)。 ClusterIdentity
位置 群集位置。 字符串
姓名 资源名称。 字符串(必需)
属性 群集创建参数。 ClusterCreatePropertiesOrClusterGetProperties
tags 资源标记。 标记名称和值的字典。 请参阅模板中的标记
类型 资源类型。 'Microsoft.HDInsight/clusters'
zones 可用性区域。 字符串[]

NetworkProperties

Name Description 价值
outboundDependenciesManagedType 一个值,用于描述如何管理 HDInsight 群集的出站依赖项。 “Managed”表示 HDInsight 服务管理出站依赖项。 “外部”是指特定于客户的解决方案负责管理出站依赖关系。 “外部”“托管”
privateLink 指示是否启用专用链接。 “禁用”“启用”
publicIpTag 获取或设置与 HDInsight 群集一起创建的公共 IP 的 IP 标记。 IpTag
resourceProviderConnection 资源提供程序连接的方向。 “入站”“出站”

OsProfile

Name Description 价值
linuxOperatingSystemProfile Linux OS 配置文件。 LinuxOperatingSystemProfile

PrivateLinkConfiguration

Name Description 价值
姓名 专用链接配置的名称。 字符串(必需)
属性 专用链接配置属性。 PrivateLinkConfigurationProperties(必需)

PrivateLinkConfigurationProperties

Name Description 价值
groupID 应用专用链接配置的 HDInsight 专用可链接子资源名称。 例如,“headnode”/ “gateway”/ “edgenode”。 字符串(必需)
ipConfigurations 专用链接服务的 IP 配置。 IPConfiguration[] (必需)

ResourceID

Name Description 价值
ID Azure 资源 ID。 字符串

角色

Name Description 价值
自动缩放 自动缩放配置。 {Autoscale}(/azure/templates/microsoft.hdinsight/clusters/pivots=deployment-language-arm-template#autoscale-1)
dataDisksGroups 角色的数据磁盘组。 DataDisksGroups []
encryptDataDisks 指示是否加密数据磁盘。 布尔
hardwareProfile 硬件配置文件。 HardwareProfile
minInstanceCount 群集的最小实例计数。 int
姓名 角色的名称。 字符串
osProfile 操作系统配置文件。 OsProfile
scriptActions 角色上的脚本操作列表。 ScriptAction[]
targetInstanceCount 群集的实例计数。 int
virtualNetworkProfile 虚拟网络配置文件。 VirtualNetworkProfile
VMGroupName 虚拟机组的名称。 字符串

ScriptAction

Name Description 价值
姓名 脚本操作的名称。 字符串(必需)
parameters 提供的脚本的参数。 字符串(必需)
uri 脚本的 URI。 字符串(必需)

StorageAccount

Name Description 价值
容器 存储帐户中的容器,仅用于为 WASB 存储帐户指定。 字符串
enableSecureChannel 启用安全通道,它是一个可选字段。 当群集版本<小于5.1时,默认值为false;当群集版本>大于或等于5.1时,默认值为true。 布尔
fileshare 文件共享名称。 字符串
fileSystem 文件系统,仅用于为 Azure Data Lake Storage Gen 2 指定。 字符串
isDefault 存储帐户是否为默认存储帐户。 布尔
关键值 存储帐户访问密钥。 字符串
msiResourceId 允许访问存储帐户的托管标识 (MSI),只能为 Azure Data Lake Storage Gen 2 指定。 字符串
姓名 存储帐户的名称。 字符串
resourceId 存储帐户的资源 ID,仅用于为 Azure Data Lake Storage Gen 2 指定。 字符串
saskey 共享访问签名密钥。 字符串

StorageProfile

Name Description 价值
存储帐户 群集中的存储帐户列表。 StorageAccount[]

UserAssignedIdentity

Name Description 价值
tenantID 用户分配标识的租户 ID。 字符串

VirtualNetworkProfile

Name Description 价值
ID 虚拟网络的 ID。 字符串
子网 子网的名称。 字符串

通过使用 ARM 模板管理启用 Microsoft Entra ID 的 Azure HDInsight 群集,微软提供了一种一致、可重复且自动化的方法来部署和配置安全的大数据环境。 ARM 模板允许将所有群集设置(包括标识、网络、存储和安全性)定义为代码,确保部署可预测且符合组织标准。

此方法不仅简化了群集预配和管理,而且与 CI/CD 管道无缝集成,使你能够自信地缩放和管理 HDInsight 工作负载。