Azure-Samples / azure-spring-boot-samples

Spring Cloud Azure Samples
MIT License
173 stars 231 forks source link

[QUERY] Issue send/receive message from servicebus using service principal #757

Closed preetishmadalia closed 2 months ago

preetishmadalia commented 2 months ago

Query/Question Followed example provided in https://github.com/Azure-Samples/azure-spring-boot-samples/tree/main/servicebus/spring-messaging-azure-servicebus/servicebus-spring-messaging

Unauthorized access. 'Send' claim(s) are required to perform this operation. Resource: 'sb:/.servicebus.windows.net/'.

I was able to verify that the SP has access to send messages. However, I am unable to execute by code with this example.

Setup (please complete the following information if applicable):

Information Checklist

saragluna commented 2 months ago

How is the RBAC of the SP configured? Could you make sure they have these role assignments? https://learn.microsoft.com/en-us/azure/developer/java/spring-framework/authentication#authorize-access-with-microsoft-entra-id

preetishmadalia commented 2 months ago

Thanks for the response. The SP has data sender role. I found an example with works now. We can close this issue.

saragluna commented 2 months ago

@preetishmadalia glad to hear that, could you share the example here, for other people who might run into the same issue?

preetishmadalia commented 2 months ago

Found below example useful.

https://github.com/Azure-Samples/azure-spring-boot-samples/blob/main/servicebus/spring-cloud-azure-starter-integration-servicebus/multiple-namespaces/spring2sample/migration-guide.md