Microsoft.ServiceBus.NamespaceManager - 托管服务身份 (MSI)

Microsoft.ServiceBus.NamespaceManager - Managed Service Identity(MSI)

有没有人设法使用 NamespaceManager 实现托管服务标识?

我已将以下示例用于 QueueClient,但似乎找不到 NamespaceManager 的任何内容。

MessagingFactorySettings messagingFactorySettings = new MessagingFactorySettings
{
    TokenProvider = TokenProvider.CreateManagedServiceIdentityTokenProvider(ServiceAudience.ServiceBusAudience),
    TransportType = TransportType.Amqp
};

messagingFactorySettings.AmqpTransportSettings.EnableLinkRedirect = false;

MessagingFactory messagingFactory = MessagingFactory.Create("sb:/namespace",
messagingFactorySettings);

QueueClient queueClient = messagingFactory.CreateQueueClient("testqueue");
queueClient.Send(new BrokeredMessage(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString())));

Has anyone managed to implement Managed Service Identity with NamespaceManager?

不幸的是,根据 Managed Service Identity (preview),我们不能 在托管服务身份中使用 .NET Framework 客户端 NamespaceManager 对象。

management operations that change the namespace topology are initially supported only though Azure Resource Manager and not through the native Service Bus REST management interface.

you cannot use the .NET Framework client NamespaceManager object within a managed service identity.

如果你想操作servicebus namcespace,我建议你使用Azure fluent SDK Microsoft.Azure.Management.Fluent and Microsoft.Azure.Management.ResourceManager.Fluent to do that. For detail demo code, you could refer to this SO thread.