有没有办法从.Net内创建一个azure服务总线命名空间?

我们正在使用.Net framework 4.6.x并寻找一种从azure.management sdk创建azure服务总线命名空间的方法。 我们无法使用C#在.Net中以编程方式实现,任何参考或直接文档都会有所帮助。 msdn上的文档似乎使用了旧的REST api,我们现在需要升级,因为windows已经完成了相同的操作。 任何不在物理门户中创建服务总线或使用REST API的方向或引用。

我们可以使用Azure流畅的SDK Microsoft.Azure.Management.Fluent和Microsoft.Azure.Management.ResourceManager.Fluent来做到这一点。 我也在我身边测试它。 它在我身边正常工作。 关于如何获取azure凭证文件,我们可以参考Azure管理库中的身份validation.NET我使用了身份validation文件。

subscription=########-####-####-####-############ client=########-####-####-####-############ tenant=########-####-####-####-############ key=XXXXXXXXXXXXXXXX managementURI=https\://management.core.windows.net/ baseURL=https\://management.azure.com/ authURL=https\://login.windows.net/ graphURL=https\://graph.windows.net/ 

演示代码。

 using Microsoft.Azure.Management.Fluent; using Microsoft.Azure.Management.ResourceManager.Fluent; using Microsoft.Azure.Management.ResourceManager.Fluent.Core; using Microsoft.Azure.Management.ServiceBus.Fluent; namespace CreateServiceBus { class Program { static void Main(string[] args) { var credentials = SdkContext.AzureCredentialsFactory.FromFile(@"C:\Tom\azureCredential.txt"); var azure = Azure .Configure() .WithLogLevel(HttpLoggingDelegatingHandler.Level.Basic) .Authenticate(credentials) .WithDefaultSubscription(); var sbNameSpace = "service bus name space"; var resoureGroup = "resourcegroup"; var serviceBusNamespace = azure.ServiceBusNamespaces .Define(sbNameSpace) .WithRegion(Region.USEast) .WithNewResourceGroup(resoureGroup) .WithSku(NamespaceSku.Basic) .Create(); } } } 

在此处输入图像描述

Packages.config