I followed Microsoft's instructions and created an enterprise application and registered it as a web application in my trial Azure instance.
I also added AAD "application" permissions ((i.e. User.Read.All, User.ReadWrite.All, Directory.Read.All, Directory.ReadWrite.All)) to this app following Microsft documentation. [https://learn.microsoft.com/en-us/graph/api/user-list?view=graph-rest-1.0&tabs=http][1]
Then I created a small C# console application to access and list the test users that I created in this web application.
I can connect and authenticate against Azure Active Directory and receive a security token from it. Still, I cannot receive the list of test users from my application even though I gave the necessary rights to this Azure application.
After receiving bearer token, the program terminates with following error message:
{"odata.error":{"code":"Authorization_RequestDenied","message":{"lang":"en","value":"Insufficient privileges to complete the operation."},"requestId":"400231dd-cd3f-4789-99ee-ab9cc3ffb95e","date":"2020-01-22T21:00:00"}}
I believe that my code is working as intended since I'm getting the bearer token. However, the rights that I gave to the Azure application is not enough to list the users of this application.
I tried to search the internet to find a possible solution to resolve my problem. I found many instances of this problem, but the issues and their resolutions seem to be a little bit different at each time.
I'm hoping that someone can provide an answer and lead me in the proper direction to resolve this access issue.
Thanks in advance,