你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Set-AzServiceBusNamespace
更新 ServiceBus 命名空间
语法
Set-AzServiceBusNamespace
-Name <String>
-ResourceGroupName <String>
[-SubscriptionId <String>]
[-AlternateName <String>]
[-DisableLocalAuth]
[-KeyVaultProperty <IKeyVaultProperties[]>]
[-RequireInfrastructureEncryption]
[-IdentityType <String>]
[-UserAssignedIdentityId <String[]>]
[-MinimumTlsVersion <String>]
[-PublicNetworkAccess <String>]
[-SkuName <String>]
[-SkuCapacity <Int32>]
[-Tag <Hashtable>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Set-AzServiceBusNamespace
[-InputObject <IServiceBusIdentity>]
[-AlternateName <String>]
[-DisableLocalAuth]
[-KeyVaultProperty <IKeyVaultProperties[]>]
[-RequireInfrastructureEncryption]
[-IdentityType <String>]
[-UserAssignedIdentityId <String[]>]
[-MinimumTlsVersion <String>]
[-PublicNetworkAccess <String>]
[-SkuName <String>]
[-SkuCapacity <Int32>]
[-Tag <Hashtable>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
更新 ServiceBus 命名空间
示例
示例 1:将 KeyVaultProperty 添加到现有 ServiceBus 命名空间
$serviceBusNamespace = Get-AzServiceBusNamespace -ResourceGroupName myResourceGroup -NamespaceName myNamespace
$newKeyVaultProperty = New-AzServiceBusKeyVaultPropertiesObject -KeyName key6 -KeyVaultUri https://testkeyvault.vault.azure.net -UserAssignedIdentity "/subscriptions/000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myFirstIdentity"
$serviceBusNamespace.KeyVaultProperty += $newKeyVaultProperty
Set-AzServiceBusNamespace -InputObject $serviceBusNamespace -KeyVaultProperty $serviceBusNamespace.KeyVaultProperty
AlternateName :
CreatedAt : 11/17/2022 5:51:52 AM
DisableLocalAuth : False
Id : /subscriptions/000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ServiceBus/namespaces/myNamespace
IdentityType :
KeySource :
KeyVaultProperty : {{
"identity": {
"userAssignedIdentity": "/subscriptions/000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/use
rAssignedIdentities/myFirstIdentity"
},
"keyName": "key4",
"keyVaultUri": "https://testkeyvault.vault.azure.net",
"keyVersion": ""
}, {
"identity": {
"userAssignedIdentity": "/subscriptions/000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/use
rAssignedIdentities/myFirstIdentity"
},
"keyName": "key5",
"keyVaultUri": "https://testkeyvault.vault.azure.net",
"keyVersion": ""
}, {
"identity": {
"userAssignedIdentity": "/subscriptions/000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/use
rAssignedIdentities/myFirstIdentity"
},
"keyName": "key6",
"keyVaultUri": "https://testkeyvault.vault.azure.net",
"keyVersion": ""
}}
Location : North Europe
MetricId : 000000000000:myNamespace
MinimumTlsVersion : 1.1
Name : myNamespace
PrincipalId :
PrivateEndpointConnection :
ProvisioningState : Succeeded
PublicNetworkAccess : Enabled
RequireInfrastructureEncryption :
ResourceGroupName : myResourceGroup
ServiceBusEndpoint : https://myNamespace.servicebus.windows.net:443/
SkuCapacity : 16
SkuName : Premium
SkuTier : Premium
Status : Active
SystemDataCreatedAt :
SystemDataCreatedBy :
SystemDataCreatedByType :
SystemDataLastModifiedAt :
SystemDataLastModifiedBy :
SystemDataLastModifiedByType :
Tag : {
}
TenantId :
Type : Microsoft.ServiceBus/Namespaces
UpdatedAt : 11/21/2022 5:01:22 AM
UserAssignedIdentity : {
}
ZoneRedundant : False
将新的 KeyVaultProperty 添加到 ServiceBus 命名空间 myNamespace
。
示例 2:从现有 ServiceBus 命名空间中删除 KeyVaultProperty
$serviceBusNamespace = Get-AzServiceBusNamespace -ResourceGroupName myResourceGroup -NamespaceName myNamespace
$serviceBusNamespace.KeyVaultProperty = $serviceBusNamespace.KeyVaultProperty[0,2]
Set-AzServiceBusNamespace -InputObject $serviceBusNamespace -KeyVaultProperty $serviceBusNamespace.KeyVaultProperty
AlternateName :
CreatedAt : 11/21/2022 5:15:41 AM
DisableLocalAuth : False
Id : /subscriptions/000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ServiceBus/namespaces/myNamespace
IdentityType : UserAssigned
KeySource : Microsoft.KeyVault
KeyVaultProperty : {{
"identity": {
"userAssignedIdentity": "/subscriptions/000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/
userAssignedIdentities/myFirstIdentity"
},
"keyName": "key4",
"keyVaultUri": "https://testkeyvault.vault.azure.net",
"keyVersion": ""
}, {
"identity": {
"userAssignedIdentity": "/subscriptions/000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/
userAssignedIdentities/myFirstIdentity"
},
"keyName": "key6",
"keyVaultUri": "https://testkeyvault.vault.azure.net",
"keyVersion": ""
}}
Location : North Europe
MetricId : 000000000000: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
SystemDataCreatedAt :
SystemDataCreatedBy :
SystemDataCreatedByType :
SystemDataLastModifiedAt :
SystemDataLastModifiedBy :
SystemDataLastModifiedByType :
Tag : {
}
TenantId :
Type : Microsoft.ServiceBus/Namespaces
UpdatedAt : 11/21/2022 8:52:02 AM
UserAssignedIdentity : {
"/subscriptions/000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/
userAssignedIdentities/myFirstIdentity": {
},
"/subscriptions/000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/
userAssignedIdentities/mySecondIdentity": {
}
}
ZoneRedundant : False
从 KeyVaultProperties 列表中删除第二个 KeyVaultProperty。
示例 3:使用 IdentityType SystemAssigned 将 UserAssigned 标识添加到命名空间以测试 SystemAssigned 和 UserAssigned
$serviceBusNamespace = Get-AzServiceBusNamespace -ResourceGroupName myResourceGroup -NamespaceName myNamespace
$id1 = "/subscriptions/000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myFirstIdentity"
$id2 = "/subscriptions/000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/mySecondIdentity"
Set-AzServiceBusNamespace -InputObject $serviceBusNamespace -IdentityType "SystemAssigned, UserAssigned" -UserAssignedIdentityId $id1, $id2
AlternateName :
CreatedAt : 11/17/2022 3:54:50 AM
DisableLocalAuth : False
Id : /subscriptions/000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ServiceBus/namespaces/myNamespace
IdentityType : SystemAssigned, UserAssigned
KeySource :
KeyVaultProperty :
Location : North Europe
MetricId : 000000000000:myNamespace
MinimumTlsVersion : 1.2
Name : myNamespace
PrincipalId : 000000000000000
PrivateEndpointConnection :
ProvisioningState : Succeeded
PublicNetworkAccess : Enabled
RequireInfrastructureEncryption :
ResourceGroupName : myResourceGroup
ServiceBusEndpoint : https://myNamespace.servicebus.windows.net:443/
SkuCapacity :
SkuName : Standard
SkuTier : Standard
Status : Active
SystemDataCreatedAt :
SystemDataCreatedBy :
SystemDataCreatedByType :
SystemDataLastModifiedAt :
SystemDataLastModifiedBy :
SystemDataLastModifiedByType :
Tag : {
}
TenantId : 0000000000000000
Type : Microsoft.ServiceBus/Namespaces
UpdatedAt : 11/21/2022 9:15:53 AM
UserAssignedIdentity : {
"/subscriptions/000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/
userAssignedIdentities/mySecondIdentity": {
},
"/subscriptions/000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/
userAssignedIdentities/myFirstIdentity": {
}
}
ZoneRedundant : False
使用 IdentityType SystemAssigned 将 UserAssigned 标识添加到命名空间,以测试 SystemAssigned 和 UserAssigned。
示例 4:# 使用 UserAssignedIdentity 创建命名空间,并使用 Set-Az cmdlet 将 IdentityType 设置为 None。
$id1 = "/subscriptions/000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myFirstIdentity"
$id2 = "/subscriptions/000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/mySecondIdentity"
$serviceBusNamespace = New-AzServiceBusNamespace -ResourceGroupName myResourceGroup -Name myNamespace -SkuName Premium -Location northeurope -IdentityType UserAssigned -UserAssignedIdentityId $id1,$id2
$serviceBusNamespace = Set-AzServiceBusNamespace -ResourceGroupName myResourceGroup -Name myNamespace -IdentityType None -UserAssignedIdentityId @()
AlternateName :
CreatedAt : 11/17/2022 3:54:50 AM
DisableLocalAuth : False
Id : /subscriptions/000000000000/resourceGroups/myResourceGroup/providers/M
icrosoft.ServiceBus/namespaces/myNamespace
IdentityType :
KeySource :
KeyVaultProperty :
Location : North Europe
MetricId : 000000000000:myNamespace
MinimumTlsVersion : 1.2
Name : myNamespace
PrincipalId :
PrivateEndpointConnection :
ProvisioningState : Succeeded
PublicNetworkAccess : Enabled
RequireInfrastructureEncryption :
ResourceGroupName : myResourceGroup
ServiceBusEndpoint : https://myNamespace.servicebus.windows.net:443/
SkuCapacity :
SkuName : Standard
SkuTier : Standard
Status : Active
SystemDataCreatedAt :
SystemDataCreatedBy :
SystemDataCreatedByType :
SystemDataLastModifiedAt :
SystemDataLastModifiedBy :
SystemDataLastModifiedByType :
Tag : {
}
TenantId :
Type : Microsoft.ServiceBus/Namespaces
UpdatedAt : 11/21/2022 9:42:32 AM
UserAssignedIdentity : {
}
ZoneRedundant : False
创建了具有 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 |
-IdentityType
托管服务标识的类型。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-InputObject
标识参数。 若要构造,请参阅 INPUTOBJECT 属性的 NOTES 部分并创建哈希表。
类型: | IServiceBusIdentity |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-KeyVaultProperty
KeyVault 的属性
类型: | IKeyVaultProperties[] |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-MinimumTlsVersion
要支持的群集的最低 TLS 版本,例如“1.2”
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Name
ServiceBusNamespace 的名称
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-NoWait
异步运行命令
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-PublicNetworkAccess
这决定了是否允许通过公用网络流量。 默认情况下,它处于启用状态。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-RequireInfrastructureEncryption
启用基础结构加密(双重加密)
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-ResourceGroupName
ResourceGroupName 的名称。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-SkuCapacity
层的指定消息传送单位。 对于高级层,容量为 1、2 和 4。
类型: | Int32 |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-SkuName
此 SKU 的名称。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-SubscriptionId
目标订阅的 ID。
类型: | String |
Position: | Named |
默认值: | (Get-AzContext).Subscription.Id |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Tag
资源标记。
类型: | 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-AzServiceBusNamespaceV2