Programatically Add Enterprise App with Graph API

Craigo 21 Reputation points
2021-02-08T17:38:48.887+00:00

We are building an enterprise application that will utilize Azure AD to authenticate users. We want to build an admin portal to this enterprise app, to build out additional enterprise applications that the users will be able to access. Is there a way to add enterprise apps without using the Azure portal?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,521 questions
{count} votes

Accepted answer
  1. JamesTran-MSFT 36,361 Reputation points Microsoft Employee
    2021-02-08T22:12:30.67+00:00

    @Craigo
    Thank you for your question! Adding to Michev's response, you can create an App or Service principle by following the below steps, using MS Graph Explorer.

    1.Create your AzureAD application

    POST https://graph.microsoft.com/v1.0/applications  
    Content-type: application/json  
    Content-length: 67  
    
    {  
      "displayName": "Display name"  
    }  
    

    2.Copy the App ID from the Graph API output, or by navigating to the App within the Azure Portal.

    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#applications/$entity",  
    "id": "33179750-.....",  
    "deletedDateTime": null,  
    "appId": "0195075e-b436...", <<Copy this appId>>  
    "applicationTemplateId": null,  
    "createdDateTime": "2021-02-08T21:34:02.3306981Z",  
    

    3.Create your Service Principle

    POST https://graph.microsoft.com/v1.0/servicePrincipals  
    Content-type: application/json  
    
    {  
      "appId": "65415bb1-9267-4313-bbf5-ae259732ee12"  
    }  
    

    65553-addapp-addsp.gif

    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.


2 additional answers

Sort by: Most helpful
  1. Dalila 6 Reputation points
    2021-09-29T11:50:31.283+00:00

    Hello,
    @Craigo , I need help please, I'm in the same situation, I need to post an Entreprise App using Graph, When I do it, my App isn't available in Entreprise App but in App registration. , even though I create a service principal it still missing in Entreprise App. Also I need to assign users to this app, Actually isn't possible with an application created through Graph.
    Thank you for any help.

    1 person found this answer helpful.

  2. Vasil Michev 94,911 Reputation points MVP
    2021-02-08T20:43:25.217+00:00

    Yes, you can create an application object or a service principal one depending on the situation: https://learn.microsoft.com/en-us/graph/api/application-post-applications?view=graph-rest-1.0&tabs=http