0

I want creates a new app in azure directory using azure rest api (not with the protal). Is there any document that describes this process? Thanks

Note

This document describes how can we create a new app using azure portal.

https://learn.microsoft.com/fr-fr/azure/active-directory/develop/active-directory-integrating-applications

I am looking if there any method to make the same but with Azure Rest API

Update

{
"odata.metadata": "https://graph.windows.net/{tenantID}/$metadata#directoryObjects/Microsoft.DirectoryServices.Application/@Element",
"odata.type": "Microsoft.DirectoryServices.Application",
"objectType": "Application",
"objectId": "ed32872e-9bf2-427c-8006-3cc69f88bfae",
"deletionTimestamp": null,
"acceptMappedClaims": null,
"addIns": [],
"appId": "6e8dbbc1-1a7e-44a8-9994-d59d454af941",
"appRoles": [],
"availableToOtherTenants": true,
"displayName": "AppAzure2",
"errorUrl": null,
"groupMembershipClaims": null,
"homepage": "http://www.monsite22/callback",
"identifierUris": [
    "https://****.onmicrosoft.com/F2F37cd1d-c44d-4f72-a747-7d702d80a8df"
],
"informationalUrls": {
    "termsOfService": null,
    "support": null,
    "privacy": null,
    "marketing": null
},
"isDeviceOnlyAuthSupported": null,
"keyCredentials": [],
"knownClientApplications": [],
"logoutUrl": null,
"[email protected]": "application/json;odata=minimalmetadata",
"logoUrl": null,
"oauth2AllowIdTokenImplicitFlow": false,
"oauth2AllowImplicitFlow": false,
"oauth2AllowUrlPathMatching": false,
"oauth2Permissions": [
    {
        "adminConsentDescription": "Allow the application to access AppAzure2 on behalf of the signed-in user.",
        "adminConsentDisplayName": "Access AppAzure2",
        "id": "872ba752-9974-4862-b5b7-bdc7a3d03df7",
        "isEnabled": true,
        "type": "User",
        "userConsentDescription": "Allow the application to access AppAzure2 on your behalf.",
        "userConsentDisplayName": "Access AppAzure2",
        "value": "user_impersonation"
    }
],
"oauth2RequirePostResponse": false,
"optionalClaims": null,
"orgRestrictions": [],
"parentalControlSettings": {
    "countriesBlockedForMinors": [],
    "legalAgeGroupRule": "Allow"
},
"passwordCredentials": [],
"publicClient": false,
"publisherDomain": null,
"recordConsentConditions": null,
"replyUrls": [
    "http://www.monsite22/callback"
],
"requiredResourceAccess": [],
"samlMetadataUrl": null,
"signInAudience": "AzureADMultipleOrgs",
"tokenEncryptionKeyId": null
}

Request Body

POST /******-91a0-4978-b46e-***********/applications?api-version=1.6 HTTP/1.1
Host: graph.windows.net
Content-Type: application/json
Authorization: Bearer ********************************************************
Cache-Control: no-cache
Postman-Token: 3daf6fe8-87db-cc48-35f0-c90901354610

{  
   "displayName":"AppAzure2",
   "publicClient":false,
   "identifierUris":[  
      "https://******.onmicrosoft.com/F2F37cd1d-c44d-4f72-a747-7d702d80a8df"
   ],
   "homepage":"http://www.monsite22/callback",
   "replyUrls":[  
      "http://www.monsite22/callback"
   ],
   "availableToOtherTenants":true
}

Token

{
  "aud": "00000002-0000-0000-c000-000000000000",
  "iss": "https://sts.windows.net/9440940f-91a0-4978-b46e-5ee05d7bd605/",
  "iat": 1528890289,
  "nbf": 1528890289,
  "exp": 1528894189,
  "aio": "Y2dgYBCPvL2QwVKroXbzbYbLLs9PAgA=",
  "appid": "***-c780-4861-a331-18400c3e5a30",
  "appidacr": "1",
  "idp": "https://sts.windows.net/9440940f-91a0-4978-b46e-5ee05d7bd605/",
  "oid": "***-183f-4817-961d-****",
  "roles": [
    "Device.ReadWrite.All",
    "Directory.Read.All",
    "Member.Read.Hidden",
    "Directory.ReadWrite.All",
    "Domain.ReadWrite.All",
    "Application.ReadWrite.OwnedBy",
    "Application.ReadWrite.All"
  ],
  "sub": "****-183f-4817-961d-****",
  "tenant_region_scope": "EU",
  "tid": "*****-91a0-4978-b46e-******",
  "uti": "mNzY050I0kOHMlog1Xg7AA",
  "ver": "1.0"
}
4
  • 2
    Maybe this would help: stackoverflow.com/a/49437309/1658906? The PowerShell cmdlets translate pretty directly into Azure AD Graph API requests Commented Jun 13, 2018 at 9:36
  • @juunas Is this already possible with graph.microsoft.com? Commented Jun 13, 2018 at 9:40
  • 1
    Via the beta endpoint yes. But it's a bit risky to use that in production at the moment as beta can change. It's still the recommendation to use Azure AD Graph API for application and service principal management as that is not available on v1.0 of MS Graph API. Commented Jun 13, 2018 at 9:41
  • @juunas Ah okay, somehow I end up always using the old graph endpoint but I feel bad about it since it is not recommended anymore. Thanks for the answer Commented Jun 13, 2018 at 9:43

1 Answer 1

2

Yes, there is. You can find the documentation here; Applications - Create.

By the way, I found this by using the awesome REST API Browser.

Welcome to the REST API Browser – your one-stop shop for REST APIs from Microsoft. Start searching for any REST APIs by typing in the box below.

Sign up to request clarification or add additional context in comments.

6 Comments

Hey, Thanks, I was able to make an api call to create an app, but the problem I can not found the app in the portal ! is that normal? I will update my question to see the result of the query
Did you create it in the correct tenant? Also: there might be a small delay. Did you get an ID or something after the API call? You might use that to check the status.
Yes, I update my question. I add the request and the response. You can have a look at the response, is that a normal behavior? Thanks for your help
Response looks quite OK. Are you looking for the application in the Azure portal? Or in the Application Registration Portal? Because it might be we're talking about the V2 endpoint here...
I check both, Azure portal in Active directory Apps and Application Registration Portal, I did not find it. It's weird because when I make this call I see the application graph.windows.net*******-91a0-4978-b46e-*****/applications?api-version=1.6
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.