通过 Powershell 或 API 扩展 Azure 服务总线

Scale Azure Service Bus through Powershell or API

我想在 Azure 上创建一个新的 Serviec Bus,然后使用自动化脚本扩展它。

现在我可以通过powershell cmdlet 成功创建服务总线 New-AzureSBNamespace -Name $Namespace -Location $Location -CreateACSNamespace $CreateACSNamespace -NamespaceType Messaging 但我找不到任何 cmdlet 或 azure 管理 API 来扩展其容量。

通过 nuget 安装 WindowsAzure.ServiceBus 后,我发现了这个 class

new Microsoft.ServiceBus.Management.MessagingSKUPlan(){SKU=2, SelectedEventHubUnit = 20 }; 但是我不知道如何使用它来扩展服务总线

我找到了终点https://manage.windowsazure.com/ServiceBus/UpdateMessagingSKUPlan http://manage.windowsazure.net 使用它来扩展服务总线,但它使用 http cookie 进行身份验证,这很难从使用 MS 证书的 Powershell 普通身份验证中实现。

我的问题是有什么方法可以从 Powershell 或 api 扩展 azure 服务总线? 如果没有,是否知道如何从我的自动化脚本中调用 https://manage.windowsazure.com/ServiceBus/UpdateMessagingSKUPlan api?

ThroughPut 单位是命名空间级别的设置,需要对 Azure 管理端点进行 REST API 调用。这需要两个步骤:

  1. 首先在 NS 上执行 GET 以获取现有的 NamespaceSKUPlan 请求 Uri 格式:https://management.core.windows.net/<subscriptipn id>/services/ServiceBus/Namespaces/<namespaceName>/MessagingPlan
  2. 然后在这个properties中对同一个Uri填充进行rest PUT操作: <NamespaceSKUPlan xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <SKU>{1 or 2}</SKU> <SelectedEventHubUnit>{1 - 20}</SelectedEventHubUnit> <Revision>{value from previous GET}</Revision> </NamespaceSKUPlan>

Set-AzureRmServiceBusNamespace -SkuCapacity 2 -ResourceGroupName <busName>