Scale Azure Service Bus through Powershell or API

喜你入骨 提交于 2020-01-06 02:55:06

问题


I want to create a new Serviec Bus on Azure and then scale it up by using automation script.

Right now I can create the service bus successfully by powershell cmdlet New-AzureSBNamespace -Name $Namespace -Location $Location -CreateACSNamespace $CreateACSNamespace -NamespaceType Messaging But I can't find any cmdlet or azure management API to scale its capacity.

After installing WindowsAzure.ServiceBus via nuget I found this class

new Microsoft.ServiceBus.Management.MessagingSKUPlan(){SKU=2, SelectedEventHubUnit = 20 }; But I don't know how to use it to scale the service bus

I've found an end point https://manage.windowsazure.com/ServiceBus/UpdateMessagingSKUPlan that used by http://manage.windowsazure.net to scale the service bus, but it's using http cookie for authentication which is hard to implement from Powershell normal authentication that using MS certificate.

My question is is there any way to scale the azure service bus from Powershell or an api? If not, is there any idea how to call https://manage.windowsazure.com/ServiceBus/UpdateMessagingSKUPlan api from my automation script?


回答1:


ThroughPut units is a Namespace level setting and will require a REST API call to the Azure Management endpoint. This requires two steps:

  1. First do a GET on NS to get the existing NamespaceSKUPlan Request Uri format: https://management.core.windows.net/<subscriptipn id>/services/ServiceBus/Namespaces/<namespaceName>/MessagingPlan
  2. Then perform a rest PUT operation on the same Uri stuffing in this properties: <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>


来源:https://stackoverflow.com/questions/31236526/scale-azure-service-bus-through-powershell-or-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!