0

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.

4

1 回答 1

3

以下是使用 Azure PowerShell cmdlet 创建它的方法(例如,在美国东部):

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

总是有 REST API。我没有将它用于服务总线,否则我会给你一个样本。相反,这里是它的链接供您参考。:)

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

如果您想要 C# 体验,还可以使用一个客户端库(预览版)。

在此处输入图像描述

以下是使用服务总线管理库的示例代码:

        // 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");
于 2014-10-03T21:03:48.330 回答