Searching users of Azure AD security group form ASP.NET Classic Web form application RRS feed

  • Question

  • Hi,

    We have ASP.NET 4.7 Web Forms application in which we are implementing Azure AD authentication.

    We have Search user feature also in the application, which actually queries the AD and adds users to our application and then grants different roles.

    We want to authenticate the users from Azure AD which are residing in different Azure AD security groups. For this we are using MSAL.NET libraries with ASP.NET 4.7 Web Form Application. 

    For searching users in AD, we tried using Microsoft Graph API but then we had to give Directory.Read permission for our application to Azure AD, which is not advisable solution. 

    Hence we wanted to use On-behalf-Of feature so that our application will query Azure AD based on authenticated user logged-in to the system instead of giving permission to Application (Directory.Read).

    Following this references https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/on-behalf-of , we are trying to implement on-behalf-of flow in our ASP.NET Forms application but then we are facing some issues.

    We get authenticated token after signing-in but when we pass the same token to Microsoft Graph API then we get nothing as result and the object is NULL only. See the code block in below screenshot:

    Code block querying Azure AD with authenticated token

    We are always getting NULL in the Group Member result.

    We would like to get some sample code with ASP.NET Classic Web Forms querying Azure AD and searching for users by passing authenticated token.



    Sanjay Nipane

    Monday, March 16, 2020 1:00 PM

All replies

  • We're migrating from MSDN to Microsoft Q&A as our new forum platform and Azure Active Directory has already made the move!  In future, you can ask and look for the discussion for Azure Active Directory related questions here.
    I have requested the engineers from Active directory team, they will be looking into this issue.

    We are actively working to onboard remaining Azure services on Microsoft Q&A. We will make a public announcement once complete. Want to Learn more about new platform: Microsoft Q&A Getting Started
    Friday, March 20, 2020 12:06 AM