命名空间:microsoft.graph
重要
Microsoft Graph /beta 版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
创建新的 application 对象。 当 @odata.type 属性设置为 #microsoft.graph.agentIdentityBlueprint时,此 API 还可以创建 agentIdentityBlueprint 对象。
重要
不要在 API 文档或代码示例中共享应用程序客户端 ID (appId) 。
此 API 可用于以下国家级云部署。
| 全局服务 | 美国政府 L4 | 美国政府 L5 (DOD) | 由世纪互联运营的中国 |
|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ |
权限
为此 API 选择标记为最低特权的权限。 只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。
| 权限类型 | 最低特权权限 | 更高特权权限 |
|---|---|---|
| 委派(工作或学校帐户) | Application.ReadWrite.All | AgentIdentityBlueprint.Create |
| 委派(个人 Microsoft 帐户) | Application.ReadWrite.All | 不可用。 |
| 应用程序 | Application.ReadWrite.OwnedBy | AgentIdentityBlueprint.Create、Application.ReadWrite.All |
重要
在具有工作或学校帐户的委派方案中,必须为管理员分配受支持的Microsoft Entra角色或具有受支持角色权限的自定义角色。 此作支持以下最低特权角色。
- 非管理员成员或具有默认用户权限的来宾,除非 租户管理员具有受限访问权限
- 应用程序开发人员 - 即使管理员限制对成员和来宾的访问权限,也可以创建应用;向具有此角色的主体分配了他们创建的应用的所有权
- 目录编写器 - 更新扩展属性
- 混合标识管理员 - 仅更新基本属性
- 安全管理员
- 云应用程序管理员
- 应用程序管理员
HTTP 请求
POST /applications
请求标头
| 名称 | 说明 |
|---|---|
| Authorization | 持有者 {token}。 必填。 详细了解 身份验证和授权。 |
| Content-Type | application/json. 必需。 |
请求正文
在请求正文中,提供 application 对象的 JSON 表示形式。 请求正文必须包含 displayName,这是必需属性。 若要创建 agentIdentityBlueprint,还要将 @odata.type 属性设置为 #microsoft.graph.agentIdentityBlueprint。
响应
如果成功,此方法在201 Created响应正文中返回响应代码和 applicationIdentityBlueprint 对象。
示例
示例 1:使用默认设置创建应用程序
请求
以下示例显示了一个请求。
POST https://graph.microsoft.com/beta/applications
Content-type: application/json
{
"displayName": "Display name"
}
响应
以下示例显示了相应的响应。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 201 Created
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#applications/$entity",
"id": "03ef14b0-ca33-4840-8f4f-d6e91916010e",
"deletedDateTime": null,
"isFallbackPublicClient": null,
"appId": "631a96bc-a705-4eda-9f99-fdaf9f54f6a2",
"applicationTemplateId": null,
"identifierUris": [],
"createdDateTime": "2019-09-17T19:10:35.2742618Z",
"displayName": "Display name",
"isDeviceOnlyAuthSupported": null,
"groupMembershipClaims": null,
"optionalClaims": null,
"addIns": [],
"publisherDomain": "contoso.com",
"samlMetadataUrl": "https://graph.microsoft.com/2h5hjaj542de/app",
"signInAudience": "AzureADandPersonalMicrosoftAccount",
"tags": [],
"tokenEncryptionKeyId": null,
"api": {
"requestedAccessTokenVersion": 2,
"acceptMappedClaims": null,
"knownClientApplications": [],
"oauth2PermissionScopes": [],
"preAuthorizedApplications": []
},
"appRoles": [],
"publicClient": {
"redirectUris": []
},
"info": {
"termsOfServiceUrl": null,
"supportUrl": null,
"privacyStatementUrl": null,
"marketingUrl": null,
"logoUrl": null
},
"keyCredentials": [],
"parentalControlSettings": {
"countriesBlockedForMinors": [],
"legalAgeGroupRule": "Allow"
},
"passwordCredentials": [],
"requiredResourceAccess": [],
"uniqueName": null,
"web": {
"redirectUris": [],
"homePageUrl": null,
"logoutUrl": null,
"implicitGrantSettings": {
"enableIdTokenIssuance": false,
"enableAccessTokenIssuance": false
}
},
"windows" : null
}
示例 2:创建新应用程序并添加密码密码
请求
POST https://graph.microsoft.com/beta/applications
Content-type: application/json
{
"displayName": "MyAppName",
"passwordCredentials": [
{
"displayName": "Password name"
}
]
}
响应
以下示例显示了相应的响应。 响应对象中的 secretText 属性包含Microsoft Entra ID生成的强密码或机密,长度为 16-64 个字符。 将来无法检索此密码。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#applications/$entity",
"id": "83ab4737-da9d-4084-86f2-f8fbec220647",
"deletedDateTime": null,
"appId": "9519e58c-bd06-4120-a7fd-2220d4de8409",
"applicationTemplateId": null,
"disabledByMicrosoftStatus": null,
"createdDateTime": "2024-04-01T19:10:02.6626202Z",
"displayName": "MyAppName",
"description": null,
"keyCredentials": [],
"parentalControlSettings": {
"countriesBlockedForMinors": [],
"legalAgeGroupRule": "Allow"
},
"passwordCredentials": [
{
"customKeyIdentifier": null,
"displayName": "Password name",
"endDateTime": "2026-04-01T19:10:02.6576213Z",
"hint": "puE",
"keyId": "09a0c91a-1bc3-4eaf-a945-c88c041fad6c",
"secretText": "1234567890abcdefghijklmnopqrstuvwxyzabcd",
"startDateTime": "2024-04-01T19:10:02.6576213Z"
}
],
"publicClient": {
"redirectUris": []
}
}
示例 3:创建新的多租户应用程序,仅限于某些租户
请求
以下示例创建一个多租户应用程序,该应用程序只能在 (的两个允许的Microsoft Entra租户中使用,并在) 注册应用的租户中使用。
POST https://graph.microsoft.com/beta/applications
Content-type: application/json
{
"displayName": "MyAppName",
"signInAudience": "AzureADMultipleOrgs",
"signInAudienceRestrictions": {
"@odata.type": "#microsoft.graph.allowedTenantsAudience",
"isHomeTenantAllowed": true,
"allowedTenantIds": [
"818ce016-78c2-457c-91d7-c02c2faaa5fe",
"c62670b0-53a1-4a38-b26c-4093cbaa510a"
]
}
}
响应
以下示例显示了相应的响应。
注意:为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#applications/$entity",
"id": "83ab4737-da9d-4084-86f2-f8fbec220647",
"appId": "9519e58c-bd06-4120-a7fd-2220d4de8409",
"createdDateTime": "2025-11-01T19:10:02.6626202Z",
"displayName": "MyAppName",
"signInAudience": "AzureADMultipleOrgs",
"signInAudienceRestrictions": {
"@odata.type": "#microsoft.graph.allowedTenantsAudience",
"isHomeTenantAllowed": true,
"allowedTenantIds": [
"818ce016-78c2-457c-91d7-c02c2faaa5fe",
"c62670b0-53a1-4a38-b26c-4093cbaa510a"
]
}
}