Reputation: 95
I have tried to get custom attributes created in Active directory using Microsoft graph. I am able to get attributes by their names using this query in Microsoft Graph
https://graph.microsoft.com/v1.0/me?$select=Department
But I'm not able to get some attributes which are not their by default (which are customly created) using microsoft graph. For an example, if I put "employeeId", the same query returns
{"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(employeeId)/$entity"}
Interestingly, I can get the employeeId using Azure AD graph which is now old school. (below query)
https://graph.windows.net/me/employeeId
Above query returns me the following Jason
{
"odata.metadata": "https://graph.windows.net/myorganization/$metadata#Edm.String",
"value": "38XXX"}
After some googling, I've found that there are extension attributes which are created using Azure AD connect which will create a Schema Extension App in Azure and we can get them using
extension_{appID}_employeeId
I can't find any Schema Extension App in my Azure Portal and I've tried some Powershell commands too. Our organization don't use Azure B2C AD. What I need is
Upvotes: 1
Views: 1177
Reputation: 95
Eventually, I've found the Tenant Schema Extension AppID buy running below query in Microsoft Graph Explorer
Note : Use Beta for Graph API version
https://graph.microsoft.com/beta/me
Which returned me a lengthy Json with below output
"userPrincipalName": "[email protected]",
"externalUserState": null,
"externalUserStateChangeDateTime": null,
"userType": "Member",
"extension_{appid}_extensionAttribute3": "XXX",
"extension_{appid}_extensionAttribute2": "XXX",
"extension_{appid}_extensionAttribute1": "XXX",
"extension_{appid}_employeeID": "XXXXXX",
Additionally, the below query returned the extension attributes even without the appid (you should use beta version)
https://graph.microsoft.com/beta/me?$select=UserPrincipalName,onPremisesExtensionAttributes
Which returned the below Json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#users(userPrincipalName,onPremisesExtensionAttributes)/$entity",
"userPrincipalName": "[email protected]",
"onPremisesExtensionAttributes": {
"extensionAttribute1": "XXX",
"extensionAttribute2": "XXX",
"extensionAttribute3": "XXX",
"extensionAttribute4": null,
"extensionAttribute5": null,
"extensionAttribute6": null,
"extensionAttribute7": null,
"extensionAttribute8": null,
"extensionAttribute9": null,
"extensionAttribute10": null,
"extensionAttribute11": null,
"extensionAttribute12": null,
"extensionAttribute13": null,
"extensionAttribute14": null,
"extensionAttribute15": null
}
}
Upvotes: 0
Reputation: 42123
A way to find AppId of Schema Extension App in Azure
If you want to find the AppId
of Schema Extension App, you could use the MS graph api below.
GET https://graph.microsoft.com/beta/applications?$filter=displayName eq 'Tenant Schema Extension App'
For more details about required permission etc, refer to this similar issue.
Upvotes: 2