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>]
Description
更新 ServiceBus 命名空間
範例
範例 1:將 KeyVaultProperty 新增至現有的 ServiceBus Namespace
$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 Namespace
$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 Identity 新增至 Namespace,以測試 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 Identity 新增至 Namespace,以測試 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
目標訂用帳戶的標識碼。
類型: | 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