How can I create a user using management.azure.com REST API?

Anonymous
2020-12-15T12:09:19.833+00:00

How can I create user in azure using rest API of management.azure.com and also assign license to it.
Is there any ARM Templates for it?

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,342 questions
0 comments No comments
{count} votes

Accepted answer
  1. JamesTran-MSFT 36,351 Reputation points Microsoft Employee
    2020-12-15T22:27:16.937+00:00

    anonymous user
    Thank you for your post! I was able to do this using Postman and the Azure Management REST APIs.

    Get all users within your Azure API Management service:

    GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users?api-version=2019-12-01  
    

    48290-image.png

    Create a user within your Azure API Management service:

    PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/users/{userId}?api-version=2019-12-01  
      
    {  
      "properties": {  
        "firstName": "foo",  
        "lastName": "bar",  
        "email": "foobar@outlook.com",  
        "confirmation": "signup"  
      }  
    }  
    

    48450-image.png

    Create or Update a subscription:

     PUT https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/subscriptions/testsub?api-version=2019-12-01  
      
    {  
      "properties": {  
        "ownerId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/users/57127d485157a511ace86ae7",  
        "scope": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/products/5600b59475ff190048060002",  
        "displayName": "testsub"  
      }  
    }  
    

    48468-image.png
    For more info - Subscriptions

    I hope this helps! If you have any other questions, please let me know.
    Thank you for your time and patience throughout this issue.

    ----------

    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.


1 additional answer

Sort by: Most helpful
  1. Cristian SPIRIDON 4,471 Reputation points
    2020-12-15T19:52:46.403+00:00

    If Microsoft Graph API is an option, there is a Gitub repo with examples for creating users and assign licenses:
    https://github.com/microsoftgraph/dotnetcore-console-sample

    Hope this helps.

    1 person found this answer helpful.
    0 comments No comments