简体   繁体   中英

Microsoft Graph Api in .net Core 2.0? Managing AD users via Web App

I'd like to add/edit/remove user contents via a .Net Core 2.0 Web App. I already created a tenant and custom policies and the Web App is working fine. I need to find a way to get and edit the contents of the tenant, add/edit/remove users, reset passwords etc. via the App. I figured Graph Api is probably the only way to do that. The thing is, my app is in .Net Core 2.0 and there's no way of migrating. Are there any other ways of implementing the funcionality I need, or is there any way to use Graph Api in .Net Core 2.0?

I am using this code sample : link

 Response from Graph:

{
"error": {
"code": "Authorization_RequestDenied",
"message": "Insufficient privileges to complete the operation.",
"innerError": {
"request-id": "xxx",
"date": "xxx"
}
}
}

Image of Perms

/// Thank you so much juunas you're amazing.

After a discussion in the comments, the problem turned out to be giving permissions to Azure AD Graph API instead of Microsoft Graph API.

And if you want all the users, use this request URL:

https://graph.microsoft.com/v1.0/users

More info about the users endpoint in MS Graph: https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/resources/users

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM