Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

etfz's avatar
Level 1

Authorization using Azure AD app roles

Hi,

This is rather Azure centric, and I'm in a bit over my head here, but I'm not sure where to go with these kind of questions.

I am looking to implement Microsoft single sign on in a web application. The idea is that all authentication and authorization will be handled by/in Azure AD, and that only select users will have access, and I think I can achieve this using Azure AD app roles.

I have created an app in Microsoft 365/Azure, installed and configured the Microsoft Socialite driver, and as far as I can tell, gotten the basic example working. I'm able to print all my user details. I now want to retrieve the user's role from Azure, and use that to authorize routes and deterrmine which elements to render. That's where I'm stuck. Is this something that would be covered by the Socialite driver, or is it a different request entirely?

0 likes
1 reply
etfz's avatar
Level 1

So I realised that I need to use the Azure driver rather than the Microsoft one. I managed to get an id_token containing the user's roles. That apparently does not work in newer versions of the Azure provider. I have opened a ticket regarding that, so setting that aside, unless someone happens to know anything about it.

On to something more Laravel related; assuming I am able to retrieve my Azure app roles from the authentication process, how would I use this with Laravel's native authorization stuff, like gates and policies?

1 like

Please or to participate in this conversation.