【问题标题】:Create new application创建新应用程序
【发布时间】:2018-06-13 09:33:28
【问题描述】:

我想使用 azure rest api(不使用 protal)在 azure 目录中创建一个新应用程序。 是否有任何文件描述了这个过程? 谢谢

注意

本文档描述了我们如何使用 azure 门户创建新应用。

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

我正在寻找是否有任何方法可以做到这一点,但使用 Azure Rest API

更新

{
"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,
"logo@odata.mediaContentType": "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
}

请求正文

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
}

令牌

{
  "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"
}

【问题讨论】:

  • 也许这会有所帮助:stackoverflow.com/a/49437309/1658906? PowerShell cmdlet 可以直接转换为 Azure AD Graph API 请求
  • @juunas 这已经可以用 graph.microsoft.com 了吗?
  • 通过 beta 端点是的。但目前在生产中使用它有点冒险,因为测试版可能会改变。仍然建议使用 Azure AD Graph API 进行应用程序和服务主体管理,因为 MS Graph API v1.0 不提供该 API。
  • @juunas 啊,好吧,不知何故,我最终总是使用旧的图形端点,但我觉得它很糟糕,因为不再推荐它。感谢您的回答

标签: azure azure-active-directory


【解决方案1】:

是的,有。你可以在这里找到文档; Applications - Create.

顺便说一句,我是通过使用很棒的REST API Browser 找到的。

欢迎使用 REST API 浏览器——您的一站式 Microsoft REST API 商店。通过在下面的框中键入开始搜索任何 REST API。

【讨论】:

  • 嘿,谢谢,我可以调用 api 来创建应用程序,但问题是我在门户中找不到应用程序!这正常吗?我将更新我的问题以查看查询结果
  • 您是否在正确的租户中创建了它?另外:可能会有一点延迟。在 API 调用之后你有没有得到一个 ID 或其他东西?您可以使用它来检查状态。
  • 是的,我更新了我的问题。我添加请求和响应。你可以看看响应,这是正常的行为吗?感谢您的帮助
  • 响应看起来还不错。您是否在 Azure 门户中寻找应用程序?还是在Application Registration Portal?因为它可能是我们在这里谈论V2 endpoint...
  • 我检查了 Active Directory 应用程序和应用程序注册门户中的 Azure 门户,我没有找到它。这很奇怪,因为当我拨打这个电话时,我看到了应用程序graph.windows.net*******-91a0-4978-b46e-*****/applications?api-version=1.6
猜你喜欢
  • 1970-01-01
  • 2019-02-01
  • 2017-09-11
  • 2015-05-21
  • 1970-01-01
  • 1970-01-01
  • 2020-02-01
  • 1970-01-01
  • 2014-03-15
相关资源
最近更新 更多