desautelsj
desautelsj

Reputation: 3715

Create Azure ServiceBus Namaspace

Is it possible to programmatically create a ServiceBus namspace, create identities, assign Send/Listen permissions, etc?

I found the following SO question from two years ago but I suspect things have changed in the mean time and the answer might be different.

Upvotes: 0

Views: 507

Answers (1)

Rick Rainey
Rick Rainey

Reputation: 11246

Here is how you can create it using the Azure PowerShell cmdlets (for example, in East US):

New-AzureSBNamespace -Name "[YOUR SB NAMESPACE NAME]" -Location "East US"

There is always the REST API. I've not used it for Service Bus or I would give you a sample. Instead, here is the link to it for your reference. :)

http://msdn.microsoft.com/en-us/library/azure/jj856303.aspx

There is also a client library (in preview) that you can use if you want the C# experience.

enter image description here

Here is sample code using the Service Bus Management Library:

        // Get this from the portal
        var subscriptionId = "5f830156-0000-0000-0000-000000000000";
        // Get this from your .publishsettings file
        var managementCert = "MIIKFAI...really long string of base64...==";

        var creds = new CertificateCloudCredentials(
            subscriptionId,
            new X509Certificate2(Convert.FromBase64String(managementCert)));

        ServiceBusManagementClient sbMgmtClient = new ServiceBusManagementClient(creds);
        sbMgmtClient.Namespaces.Create("[YOUR SB NAMESPACE NAME]", "East US");

Upvotes: 3

Related Questions