Reputation: 25
I defined a custom attribute (CompanyName - string) which identifies a company uniquely. There will be only 1 user per company. Currently I am struggling to find a way to mark this attribute as unique. Is it supported ? Or do i need to do something else ?
Upvotes: 1
Views: 382
Reputation: 14634
You can't declare a custom attribute as unique so you must validate the attribute value, when it is entered by a new user, using a custom policy that invokes a REST API that validates the user input.
The REST API can query whether the attribute value already exists using an Azure AD Graph API request such as:
https://graph.windows.net/myorganization/users?$filter=extension_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_CompanyName eq 'Contoso'
Upvotes: 5