Ammaroff
Ammaroff

Reputation: 954

Scale Azure Service Bus through Powershell or API

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. Scale Service Bus from Azure Management Portal

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?

Upvotes: 1

Views: 687

Answers (2)

user2483341
user2483341

Reputation: 11

See

Set-AzureRmServiceBusNamespace -SkuCapacity 2 -ResourceGroupName <busName>

Upvotes: 1

Ammaroff
Ammaroff

Reputation: 954

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>

Upvotes: 3

Related Questions