question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Azure Service Bus UnauthorizedException when using Managed Identity

See original GitHub issue

When using Managed Identity to authenticate towards Azure Service Bus we get an UnauthorizedException when publishing a message with following error message: Microsoft.Azure.ServiceBus.UnauthorizedException: ‘claim is empty. TrackingId:daa79edb-af0f-42d0-8583-b5d6006d1815_G5, SystemTracker:NoSystemTracker, Timestamp:2020-03-13T08:22:50’

Gist to reproduce: https://gist.github.com/mathiasbl/9c779c8d09a3a2807b0d10679959d81b How to setup managed identity: https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-managed-service-identity My app and myself have the service bus owner role.

MassTransit.Azure.ServiceBus.Core: 5.5.6

Stack: 2020-03-12 {“Message”:“claim is empty. TrackingId:dc3767cf-a902-4014-bd6d-df8e7f81ac26_G7, SystemTracker:NoSystemTracker, Timestamp:2020-03-12T09:45:23”, “IsTransient”:false, “Data”:{}, “TargetSite”:“Void MoveNext()”, “StackTrace”:" at Microsoft.Azure.ServiceBus.Management.ManagementClient.SendHttpRequest(HttpRequestMessage request, CancellationToken cancellationToken) at Microsoft.Azure.ServiceBus.Management.ManagementClient.GetEntity(String path, String query, Boolean enrich, CancellationToken cancellationToken) at Microsoft.Azure.ServiceBus.Management.ManagementClient.GetTopicAsync(String topicPath, CancellationToken cancellationToken) at Microsoft.Azure.ServiceBus.Management.ManagementClient.TopicExistsAsync(String topicPath, CancellationToken cancellationToken) at MassTransit.Azure.ServiceBus.Core.Contexts.NamespaceManager.<>c__DisplayClass25_01.<<RunOperation>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func1 operation, TimeSpan operationTimeout) at Microsoft.Azure.ServiceBus.RetryPolicy.RunOperation(Func1 operation, TimeSpan operationTimeout) at MassTransit.Azure.ServiceBus.Core.Contexts.NamespaceManager.RunOperation[T](Func1 operation) at MassTransit.Azure.ServiceBus.Core.Contexts.ServiceBusNamespaceContext.CreateTopic(TopicDescription topicDescription) at MassTransit.Azure.ServiceBus.Core.Pipeline.ConfigureTopologyFilter1.ConfigureTopology(NamespaceContext context) at MassTransit.Azure.ServiceBus.Core.Pipeline.ConfigureTopologyFilter1.<>c__DisplayClass6_0.<<Send>b__0>d.MoveNext() — End of stack trace from previous location where exception was thrown — at GreenPipes.PipeExtensions.OneTimeSetup[T](PipeContext context, Func2 setupMethod, PayloadFactory1 payloadFactory) at MassTransit.Azure.ServiceBus.Core.Pipeline.ConfigureTopologyFilter1.Send(NamespaceContext context, IPipe1 next) at GreenPipes.Agents.AsyncPipeContextPipe1.Send(TContext context) at GreenPipes.Agents.PipeContextSupervisor1.GreenPipes.IPipeContextSource<TContext>.Send(IPipe1 pipe, CancellationToken cancellationToken) at GreenPipes.Agents.PipeContextSupervisor1.GreenPipes.IPipeContextSource<TContext>.Send(IPipe1 pipe, CancellationToken cancellationToken) at GreenPipes.Agents.PipeContextSupervisor1.GreenPipes.IPipeContextSource<TContext>.Send(IPipe1 pipe, CancellationToken cancellationToken) at MassTransit.Azure.ServiceBus.Core.Pipeline.JoinContextFactory3.<>c__DisplayClass8_0.<<CreateJoinContext>g__Join|0>d.MoveNext() — End of stack trace from previous location where exception was thrown — at MassTransit.Azure.ServiceBus.Core.Pipeline.TopicSendEndpointContextFactory.CreateSharedContext(Task1 context, CancellationToken cancellationToken) at GreenPipes.Agents.PipeContextSupervisor1.GreenPipes.IPipeContextSource<TContext>.Send(IPipe1 pipe, CancellationToken cancellationToken) at GreenPipes.Agents.PipeContextSupervisor1.GreenPipes.IPipeContextSource<TContext>.Send(IPipe1 pipe, CancellationToken cancellationToken) at GreenPipes.Agents.PipeContextSupervisor1.GreenPipes.IPipeContextSource<TContext>.Send(IPipe1 pipe, CancellationToken cancellationToken) at MassTransit.Transports.PublishEndpoint.Publish[T](CancellationToken cancellationToken, T message, PublishEndpointPipeAdapter1 adapter) at MassTransit.Transports.PublishEndpoint.Publish[T](CancellationToken cancellationToken, T message, PublishEndpointPipeAdapter`1 adapter)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
phatboygcommented, Mar 13, 2020

Right, it causes issues with RBAC I guess. And click on one of the topics and it will show you.

image

1reaction
mathiasblcommented, Mar 13, 2020

Seems like MassTransit 5.x.x is using “~” to separate namespace and the message name while 6.x.x is using “/”. The “/” and “~” is causing issues when using RBAC.

Topic: https://stackoverflow.com/questions/58288680/rbac-issues-using-masstransit-with-azure-service-bus-and-msi-authentication

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure Service Bus managed identity in Visual Studio ...
I'm attempting to access Azure Service Bus using a managed identity from my code. At the moment I'm just trying this locally.
Read more >
Cant get the message from the service bus queue. Even ...
This looks like the configuration issue where your system assigned identity is not correctly configured/add correct with your service bus ...
Read more >
Troubleshooting guide for Azure Service Bus
Learn about troubleshooting tips and recommendations for a few issues that you may see when using Azure Service Bus.
Read more >
Azure ServiceBusClient, App registrations, "System. ...
I have already configured App and added this as service bus contributors. I get this error: System.UnauthorizedAccessException: 'Unauthorized ...
Read more >
Managed identities for Azure resources with Service Bus
This article describes how to use managed identities to access with Azure Service Bus entities (queues, topics, and subscriptions).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found