通过Powershell或API扩展Azure Service Bus

时间:2015-07-06 00:59:55

标签: azure azureservicebus

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

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

通过nuget安装WindowsAzure.ServiceBus之后我找到了这个类

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

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

我的问题是有没有办法从Powershell或api扩展azure服务总线? 如果没有,是否有任何想法如何从我的自动化脚本调用https://manage.windowsazure.com/ServiceBus/UpdateMessagingSKUPlan api?

2 个答案:

答案 0 :(得分:3)

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

  1. 首先在NS上进行GET以获取现有的NamespaceSKUPlan 请求Uri格式:https://management.core.windows.net/<subscriptipn id>/services/ServiceBus/Namespaces/<namespaceName>/MessagingPlan
  2. 然后对此属性中的相同Uri填充执行休息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>

答案 1 :(得分:1)

请参见

Set-AzureRmServiceBusNamespace -SkuCapacity 2 -ResourceGroupName <busName>