你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Set-AzEventHubNamespace
更新 EventHub 命名空间
语法
Set-AzEventHubNamespace
-Name <String>
-ResourceGroupName <String>
[-SubscriptionId <String>]
[-AlternateName <String>]
[-DisableLocalAuth]
[-KeyVaultProperty <IKeyVaultProperties[]>]
[-RequireInfrastructureEncryption]
[-IdentityType <String>]
[-UserAssignedIdentityId <String[]>]
[-EnableAutoInflate]
[-MaximumThroughputUnit <Int32>]
[-MinimumTlsVersion <String>]
[-PublicNetworkAccess <String>]
[-SkuCapacity <Int32>]
[-Tag <Hashtable>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzEventHubNamespace
-InputObject <IEventHubIdentity>
[-AlternateName <String>]
[-DisableLocalAuth]
[-KeyVaultProperty <IKeyVaultProperties[]>]
[-RequireInfrastructureEncryption]
[-IdentityType <String>]
[-UserAssignedIdentityId <String[]>]
[-EnableAutoInflate]
[-MaximumThroughputUnit <Int32>]
[-MinimumTlsVersion <String>]
[-PublicNetworkAccess <String>]
[-SkuCapacity <Int32>]
[-Tag <Hashtable>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
更新 EventHub 命名空间
示例
示例 1:向 EventHub 命名空间添加 ManagedIdentity
$eventHubNamespace = Get-AzEventHubNamespace -ResourceGroupName myResourceGroup -Name myNamespace
$identityId = $eventHubNamespace.UserAssignedIdentity.Keys
$identityId += "/subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/mySecondIdentity"
Set-AzEventHubNamespace -InputObject $eventHubNamespace -UserAssignedIdentityId $identityId
AlternateName :
ClusterArmId :
CreatedAt : 11/17/2022 2:56:32 PM
DisableLocalAuth : False
EnableAutoInflate : False
Id : /subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.EventHub/namespaces/myNamespace
IdentityType : UserAssigned
KafkaEnabled : True
KeySource : Microsoft.KeyVault
KeyVaultProperty : {{
"identity": {
"userAssignedIdentity": "/subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myFirstIdentity"
},
"keyName": "key1",
"keyVaultUri": "https://testkeyvault.vault.azure.net/",
"keyVersion": ""
}, {
"identity": {
"userAssignedIdentity": "/subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myFirstIdentity"
},
"keyName": "key2",
"keyVaultUri": "https://testkeyvault.vault.azure.net/",
"keyVersion": ""
}, {
"identity": {
"userAssignedIdentity": "/subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myFirstIdentity"
},
"keyName": "key3",
"keyVaultUri": "https://testkeyvault.vault.azure.net/",
"keyVersion": ""
}}
Location : North Europe
MaximumThroughputUnit : 0
MetricId : 000000000000000:myNamespace
MinimumTlsVersion : 1.2
Name : myNamespace
PrincipalId :
PrivateEndpointConnection :
ProvisioningState : Succeeded
PublicNetworkAccess : Enabled
RequireInfrastructureEncryption : False
ResourceGroupName : myResourceGroup
ServiceBusEndpoint : https://myNamespace.servicebus.windows.net:443/
SkuCapacity : 1
SkuName : Premium
SkuTier : Premium
Status : Active
Tag : {
}
TenantId :
Type : Microsoft.EventHub/Namespaces
UpdatedAt : 11/17/2022 3:03:50 PM
UserAssignedIdentity : {
"/subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myFirstIdentity": {
},
"/subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/mySecondIdentity": {
}
}
ZoneRedundant : True
New 和 Set cmdlet 的输出类型 IEhNamespace
具有名为 UserAssignedIdentity
的属性,该属性是哈希表。
此可获取的密钥是命名空间所属的托管标识的资源 ID。
若要添加或删除 IdentityId,请从哈希表中提取密钥,这将导致字符串数组,然后可以查询这些字符串并将其作为输入馈送,以设置 cmdlet,如上所示。
示例 2:将 KeyVaultProperty 添加到现有 EventHub 命名空间
$eventHubNamespace = Get-AzEventHubNamespace -ResourceGroupName myResourceGroup -Name myNamespace
$newKeyVaultProperty = New-AzEventHubKeyVaultPropertiesObject -KeyName key3 -KeyVaultUri https://testkeyvault.vault.azure.net -UserAssignedIdentity "/subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myFirstIdentity"
$eventHubNamespace.KeyVaultProperty += $newKeyVaultProperty
Set-AzEventHubNamespace -InputObject $eventHubNamespace -KeyVaultProperty $eventHubNamespace.KeyVaultProperty
AlternateName :
ClusterArmId :
CreatedAt : 11/17/2022 2:56:32 PM
DisableLocalAuth : False
EnableAutoInflate : False
Id : /subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.EventHub/namespaces/myNamespace
IdentityType : UserAssigned
KafkaEnabled : True
KeySource : Microsoft.KeyVault
KeyVaultProperty : {{
"identity": {
"userAssignedIdentity": "/subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myFirstIdentity"
},
"keyName": "key1",
"keyVaultUri": "https://testkeyvault.vault.azure.net",
"keyVersion": ""
}, {
"identity": {
"userAssignedIdentity": "/subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myFirstIdentity"
},
"keyName": "key2",
"keyVaultUri": "https://testkeyvault.vault.azure.net",
"keyVersion": ""
}, {
"identity": {
"userAssignedIdentity": "/subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myFirstIdentity"
},
"keyName": "key3",
"keyVaultUri": "https://testkeyvault.vault.azure.net",
"keyVersion": ""
}}
Location : North Europe
MaximumThroughputUnit : 0
MetricId : 000000000000000:myNamespace
MinimumTlsVersion : 1.2
Name : myNamespace
PrincipalId :
PrivateEndpointConnection :
ProvisioningState : Succeeded
PublicNetworkAccess : Enabled
RequireInfrastructureEncryption : False
ResourceGroupName : myResourceGroup
ServiceBusEndpoint : https://myNamespace.servicebus.windows.net:443/
SkuCapacity : 1
SkuName : Premium
SkuTier : Premium
Status : Active
Tag : {
}
TenantId :
Type : Microsoft.EventHub/Namespaces
UpdatedAt : 11/17/2022 3:03:50 PM
UserAssignedIdentity : {
"/subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myFirstIdentity": {
},
"/subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/mySecondIdentity": {
}
}
ZoneRedundant : True
将新的 KeyVaultProperty 添加到 EventHub 命名空间 myNamespace
。
示例 3:从现有 EventHub 命名空间中删除 KeyVaultProperty
$eventHubNamespace = Get-AzEventHubNamespace -ResourceGroupName myResourceGroup -Name myNamespace
# Remove the last KeyVaultProperty from the list of KeyVaultProperties
$eventHubNamespace.KeyVaultProperty = $eventHubNamespace.KeyVaultProperty | Where-Object { $_ -ne $eventHubNamespace.KeyVaultProperty[2] }
Set-AzEventHubNamespace -InputObject $eventHubNamespace -KeyVaultProperty $eventHubNamespace.KeyVaultProperty
AlternateName :
ClusterArmId :
CreatedAt : 11/17/2022 2:56:32 PM
DisableLocalAuth : False
EnableAutoInflate : False
Id : /subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.EventHub/namespaces/myNamespace
IdentityType : UserAssigned
KafkaEnabled : True
KeySource : Microsoft.KeyVault
KeyVaultProperty : {{
"identity": {
"userAssignedIdentity": "/subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myFirstIdentity"
},
"keyName": "key1",
"keyVaultUri": "https://testkeyvault.vault.azure.net",
"keyVersion": ""
}, {
"identity": {
"userAssignedIdentity": "/subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myFirstIdentity"
},
"keyName": "key2",
"keyVaultUri": "https://testkeyvault.vault.azure.net",
"keyVersion": ""
}}
Location : North Europe
MaximumThroughputUnit : 0
MetricId : 000000000000000:myNamespace
MinimumTlsVersion : 1.2
Name : myNamespace
PrincipalId :
PrivateEndpointConnection :
ProvisioningState : Succeeded
PublicNetworkAccess : Enabled
RequireInfrastructureEncryption : False
ResourceGroupName : myResourceGroup
ServiceBusEndpoint : https://myNamespace.servicebus.windows.net:443/
SkuCapacity : 1
SkuName : Premium
SkuTier : Premium
Status : Active
Tag : {
}
TenantId :
Type : Microsoft.EventHub/Namespaces
UpdatedAt : 11/17/2022 3:03:50 PM
UserAssignedIdentity : {
"/subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myFirstIdentity": {
},
"/subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/mySecondIdentity": {
}
}
ZoneRedundant : True
将新的 KeyVaultProperty 删除到 EventHub 命名空间 myNamespace
。
示例 4:在现有 EventHub 命名空间上将 DisableLocalAuth 设置为 true
Set-AzEventHubNamespace -ResourceGroupName myResourceGroup -Name myNamespace -DisableLocalAuth
AlternateName :
ClusterArmId :
CreatedAt : 11/17/2022 2:56:32 PM
DisableLocalAuth : False
EnableAutoInflate : False
Id : /subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.EventHub/namespaces/myNamespace
IdentityType : UserAssigned
KafkaEnabled : True
KeySource : Microsoft.KeyVault
KeyVaultProperty : {{
"identity": {
"userAssignedIdentity": "/subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myFirstIdentity"
},
"keyName": "key1",
"keyVaultUri": "https://testkeyvault.vault.azure.net",
"keyVersion": ""
}, {
"identity": {
"userAssignedIdentity": "/subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myFirstIdentity"
},
"keyName": "key2",
"keyVaultUri": "https://testkeyvault.vault.azure.net",
"keyVersion": ""
}}
Location : North Europe
MaximumThroughputUnit : 0
MetricId : 000000000000000:myNamespace
MinimumTlsVersion : 1.2
Name : myNamespace
PrincipalId :
PrivateEndpointConnection :
ProvisioningState : Succeeded
PublicNetworkAccess : Enabled
RequireInfrastructureEncryption : False
ResourceGroupName : myResourceGroup
ServiceBusEndpoint : https://myNamespace.servicebus.windows.net:443/
SkuCapacity : 1
SkuName : Premium
SkuTier : Premium
Status : Active
Tag : {
}
TenantId :
Type : Microsoft.EventHub/Namespaces
UpdatedAt : 11/17/2022 3:03:50 PM
UserAssignedIdentity : {
"/subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myFirstIdentity": {
},
"/subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/mySecondIdentity": {
}
}
ZoneRedundant : True
在 EventHub 命名空间 myNamespace
上将 DisableLocalAuth
设置为 true。
示例 5:# 使用 UserAssignedIdentity 创建命名空间,并使用 Set-Az cmdlet 将 IdentityType 设置为 None。
$eventHubNamespace = New-AzEventHubNamespace -ResourceGroupName myResourceGroup -Name myNamespace -SkuName Premium -Location northeurope -IdentityType UserAssigned -UserAssignedIdentityId "/subscriptions/000000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myFirstIdentity"
$eventHubNamespace = Set-AzEventHubNamespace -ResourceGroupName myResourceGroup -Name myNamespace -IdentityType None -UserAssignedIdentityId @()
AlternateName :
ClusterArmId :
CreatedAt : 11/21/2022 3:21:29 PM
DisableLocalAuth : False
EnableAutoInflate : False
Id : /subscriptions/000000000000000/resourceGroups/myResourceGroup/provide
rs/Microsoft.EventHub/namespaces/myNamespace
IdentityType :
KafkaEnabled : True
KeySource :
KeyVaultProperty :
Location : North Europe
MaximumThroughputUnit : 0
MetricId : 000000000000000:myNamespace
MinimumTlsVersion : 1.2
Name : myNamespace
PrincipalId :
PrivateEndpointConnection :
ProvisioningState : Succeeded
PublicNetworkAccess : Enabled
RequireInfrastructureEncryption :
ResourceGroupName : myResourceGroup
ServiceBusEndpoint : https://myNamespace.servicebus.windows.net:443/
SkuCapacity : 1
SkuName : Premium
SkuTier : Premium
Status : Active
SystemDataCreatedAt :
SystemDataCreatedBy :
SystemDataCreatedByType :
SystemDataLastModifiedAt :
SystemDataLastModifiedBy :
SystemDataLastModifiedByType :
Tag : {
}
TenantId :
Type : Microsoft.EventHub/Namespaces
UpdatedAt : 11/21/2022 3:31:03 PM
UserAssignedIdentity : {
}
ZoneRedundant : True
创建了具有 UserAssignedIdentity 的命名空间,并使用 Set-Az cmdlet 将 IdentityType 设置为 None。
参数
-AlternateName
别名和命名空间名称相同时指定的备用名称
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-AsJob
以作业身份运行命令
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Confirm
在运行 cmdlet 之前,提示你进行确认。
类型: | SwitchParameter |
别名: | cf |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-DefaultProfile
用于与 Azure 通信的凭据、帐户、租户和订阅。
类型: | PSObject |
别名: | AzureRMContext, AzureCredential |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-DisableLocalAuth
此属性禁用事件中心命名空间的 SAS 身份验证。
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-EnableAutoInflate
指示是否为 eventhub 命名空间启用 AutoInflate 的值。
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-IdentityType
托管服务标识的类型。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-InputObject
标识参数。 若要构造,请参阅 INPUTOBJECT 属性的 NOTES 部分并创建哈希表。
类型: | IEventHubIdentity |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-KeyVaultProperty
用于配置加密的属性
类型: | IKeyVaultProperties[] |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-MaximumThroughputUnit
启用 AutoInflate 时吞吐量单位的上限,值应在 0 到 20 个吞吐量单位内。 (如果 AutoInflateEnabled = true,则为“0” )
类型: | Int32 |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-MinimumTlsVersion
要支持的群集的最低 TLS 版本,例如“1.2”
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Name
EventHub 命名空间的名称。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-PublicNetworkAccess
这决定了是否允许通过公用网络流量。 默认情况下,它处于启用状态。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-RequireInfrastructureEncryption
启用基础结构加密(双重加密)
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-ResourceGroupName
资源组的名称。 名称不区分大小写。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-SkuCapacity
基本层或标准层的事件中心吞吐量单位,其中值应为 0 到 20 个吞吐量单位。 高级层的事件中心高级单位,其中值应为 0 到 10 个高级单位。
类型: | Int32 |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-SubscriptionId
目标订阅的 ID。
类型: | String |
Position: | Named |
默认值: | (Get-AzContext).Subscription.Id |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Tag
EventHub 命名空间的标记。
类型: | Hashtable |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-UserAssignedIdentityId
用户分配标识的属性
类型: | String[] |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-WhatIf
显示 cmdlet 运行时会发生什么情况。 cmdlet 未运行。
类型: | SwitchParameter |
别名: | wi |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
输入
输出
备注
别名
Set-AzEventHubNamespaceV2