我需要自动化从库中添加应用程序(即Trello),配置它(即密码单点登录)并为其分配用户的过程。
可以通过Graph API完成吗?
答案 0 :(得分:2)
是。 通过在与Trello应用程序对应的目录中创建servicePrincipal,可以自动将Trello添加到Azure AD目录。默认的SSO设置是密码SSO。您还可以使用图API分配用户(和组)。但是,分配的用户需要手动配置他们将与应用程序一起使用的密码。
将Trello添加到目录(创建servicePrincipal):
HTTP POST https://graph.windows.net/7fe877e6-a150-4992-bbfe
f517e304dfa0/servicePrincipals?api-version=1.5
Authorization : Bearer eyJ0eXO--snip--zvg
Content-Type : application/json
Content-Length : 58
{
"appId": "a4937c28-17cc-469b-b082-1d6124a402f3"
}
Query successfully executed.
odata.metadata : https://graph.windows.net/7fe877e6-a150-4992-bbfe-f517e304dfa0/$metadata#directoryObjects/Microsoft.DirectorySer
vices.ServicePrincipal/@Element
odata.type : Microsoft.DirectoryServices.ServicePrincipal
objectType : ServicePrincipal
objectId : 93c60e8e-74f9-4add-9ae2-dd9bc0d6edcd
deletionTimestamp :
accountEnabled : True
appDisplayName : Trello
appId : a4937c28-17cc-469b-b082-1d6124a402f3
appOwnerTenantId : 47df5bb7-e6bc-4256-afb0-dd8c8e3c1ce8
appRoleAssignmentRequired : False
appRoles : {@{allowedMemberTypes=System.Object[]; description=msiam_access; displayName=msiam_access;
id=fc60bc23-43df-4a60-baaa-f0b8694e0259; isEnabled=True; value=}}
displayName : Trello
errorUrl :
homepage : https://127.0.0.1:444/applications/default.aspx?metadata=trello|ISV9.3|primary|z
keyCredentials : {}
logoutUrl :
oauth2Permissions : {}
passwordCredentials : {}
preferredTokenSigningKeyThumbprint :
publisherName : Active Directory Application Registry
replyUrls : {https://127.0.0.1:444/applications/default.aspx}
samlMetadataUrl :
servicePrincipalNames : {a4937c28-17cc-469b-b082-1d6124a402f3, http://adapplicationregistry.onmicrosoft.com/trello/primary}
tags : {}
将主体(用户或组)分配给Trello:
HTTP POST https://graph.windows.net/7fe877e6-a150-4992-bbfe-f517e304dfa0/users/de4b092e-1dd4-4d40-b74d-a2d7096c9495/appRoleAssignments?api-version=1.5
Authorization : Bearer eyJ0eXAiOi--snip--JKVBfk_Q
Content-Type : application/json
Content-Length : 176
{
"id": "fc60bc23-43df-4a60-baaa-f0b8694e0259",
"principalId": "de4b092e-1dd4-4d40-b74d-a2d7096c9495",
"resourceId": "93c60e8e-74f9-4add-9ae2-dd9bc0d6edcd"
}
Query successfully executed.
odata.metadata : https://graph.windows.net/7fe877e6-a150-4992-bbfe-f517e304dfa0/$metadata#directoryObjects/Microsoft.DirectoryServices.AppRoleA
ssignment/@Element
odata.type : Microsoft.DirectoryServices.AppRoleAssignment
objectType : AppRoleAssignment
objectId : LglL3tQdQE23TaLXCWyUlVPgf9W8rhZBi1YqpnYOyMg
deletionTimestamp :
creationTimestamp : 2015-01-29T05:52:12.4851494Z
id : fc60bc23-43df-4a60-baaa-f0b8694e0259
principalDisplayName :
principalId : de4b092e-1dd4-4d40-b74d-a2d7096c9495
principalType : User
resourceDisplayName : Trello
resourceId : 93c60e8e-74f9-4add-9ae2-dd9bc0d6edcd
分配的用户将在其访问面板(myapp.microsoft.com)中看到该应用。他们需要手动更新凭证。