Masayuki
Masayuki

Reputation: 189

Unique user id in multi tenant Azure AD apps

Do you know the unique user id in multi tenant Azure AD apps pattern?

I'm now developing app using Microsoft Graph with Azure AD multi-tenant application pattern. For identifying each user I want to know the unique id - I'll use it as a key in our own database to save user's data.

In this reference, id parameter in user object is "The unique identifier for the user", but I wonder is it unique id in each tenant or in all tenant? It is important thing because my app will use in multi tenant.

FYI: If user id is unique only in each tenant, I'll concatenate organization id and user id for making unique id in all tenant.

Upvotes: 3

Views: 4211

Answers (1)

RasmusW
RasmusW

Reputation: 3461

The id property is a random GUID. While it would be unlikely to have two users with identical IDs, unless there is a check in Azure, it could happen.

I would concatenate it with the tenant ID, or even better have the tenant ID in another column in the DB. That way you can query users on a per-tenant basis in your DB.

Upvotes: 2

Related Questions