Azure AD API POST
Azure AD API POST
Azure AD API POST
According to the Azure AD Graph API documentation¹, you can perform various operations on users
using POST requests, such as:
For each operation, you need to specify the URI of the resource, the HTTP method (POST), the
access token, and the request body with the relevant data. For example, if you want to assign a
manager to a user using a POST request, you can use the following syntax¹:
```http
POST https://graph.windows.net/myorganization/users/{user_id}/manager/$ref?api-version=1.6
Content-Type: application/json
"url": "https://graph.windows.net/myorganization/users/{manager_id}"
```
Source : conversation avec Bing, 18/03/2023(1) Azure AD Graph API Operations on Users |
Microsoft Learn. https://learn.microsoft.com/fr-fr/previous-versions/azure/ad/graph/api/users-
operations Consultée 18/03/2023.
For example, if you want to create a new user in Azure AD using a POST request operation, you can
use the following syntax³:
```csharp
// Set the URI of the resource (Azure AD Graph API endpoint for creating a user)
// Set the HTTP method (POST) and the content type header
request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
user.accountEnabled = true;
user.displayName = "Alex Wu";
user.mailNickname = "AlexW";
user.passwordProfile.password = "Test1234";
user.passwordProfile.forceChangePasswordNextLogin = false;
user.userPrincipalName = "AlexW@contoso.onmicrosoft.com";
// Serialize the user object into JSON format and set it as the request body
if (response.IsSuccessStatusCode)
else
```
Source : conversation avec Bing, 18/03/2023(1) Azure REST API reference documentation |
Microsoft Learn. https://learn.microsoft.com/en-us/rest/api/azure/ Consultée 18/03/2023.
(3) How to call external api with Azure function with POST method with ....
https://stackoverflow.com/questions/69875752/how-to-call-external-api-with-azure-function-with-
post-method-with-request-body Consultée 18/03/2023.