0
votes

I am trying to add user using Microsoft graph API.

I have provided the consent for all the permissions required.

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

Request body that is send to the post request.

{
    "accountEnabled": true,
    "displayName": "Adele Vance",
    "mailNickname": "AdeleV",
    "userPrincipalName": "[email protected]",
    "passwordProfile": {
        "forceChangePasswordNextSignIn": true,
        "password": "xWwvJ]6NMw+bWH-d"
    }
}

Error that is received in response

{
    "error": {
        "code": "",
        "message": "No HTTP resource was found that matches the request URI 'https://outlook.office365.com:444/profile/v1.0/users('CID:0ff49e4749deeaf2')/profile?api-version=AGSV1-internal'.",
        "innerError": {
            "date": "2021-02-04T10:41:56",
            "request-id": "025218e1-191c-464f-adf3-f0cdc5fcebfd",
            "client-request-id": "c071d220-2f14-d7fa-956e-cd45ccbdc735"
        }
    }
}

Is there something that I am missing?

I have also gone through the docs for adding user provided by Microsoft.

https://docs.microsoft.com/en-us/graph/api/user-post-users?view=graph-rest-1.0&tabs=http

2
The above looks perfectly fine to me Have you tested it in Graph ExplorerShiva Keshav Varma
Did you execute multiple requests? Can you provide your code?Carl Zhao
What is the exact request? Do you have single tenat or multitenant app?user2250152
I was able to add add user using an Organisation account but not through personal account. I was adding user using Microsoft Graph API. I have tested it on Graph Explorer as well.bippan
It does not support Microsoft personal accounts.Carl Zhao

2 Answers

0
votes

You will have to check the end point are you using to authorize in order to obtain the token.

If you are using a tenant specific end point

https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize? client_id=6731de76-14a6-49ae-97bc-6eba6914391e

Try replacing with the common endpoint

https://login.microsoftonline.com/common/oauth....
0
votes

What you said in the comment is correct, the document has detailed instructions, it does not support Microsoft personal accounts.

enter image description here