I'm fairly new to using the servicebus and other Azure features. After creating a servicebus manually on the Azure portal, I try to figure out how this can be achieved automatically. After a while of reading I thought that using the azure resource manager should be the way to go. Deploying just one topic is no big deal. But I can't find an example, that shows how to deploy multiple topics and queues at once. Or am I on the wrong approach?
Thanks for your answers!
Helmut
What we do (and I saw other teams doing the same) is simple: when your producer/consumer application starts, it checks if required queues/topics/subscriptions exist, and creates them otherwise.
So we create all Service Bus entities from C# code, which also gives the full flexibility for options.
Code sample:
var namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);
if (!namespaceManager.TopicExists(topicName))
{
namespaceManager.CreateTopic(new TopicDescription(topicName));
namespaceManager.CreateSubscription(
new SubscriptionDescription(topicName, subscriptionName));
}
That's not to say your ARM approach is wrong or bad, just to give a simple alternative.
Using the new azure portal (here), there is an Automation script
feature.
I've created a new resource group with a service bus namespace that contains 2 topics and 1 queue:
You can see on the left panel, there is an Automation script
feature.
In this section, you can find a template that represents the resources that you've created manually. you can then use this template to automate your deployment to others environment.
See also Deploy resources with Resource Manager templates and Azure PowerShell