A cloud-based identity and access management service for securing user authentication and resource access
For samAccountName/UPN generation, expressions support generating multiple candidate values and then picking the first unique one, but they do not support dynamically “shrinking” and “growing” both first and last name segments in the exact pattern described.
Supported pattern for uniqueness
The supported way to implement uniqueness is to:
- Build a sequence of candidate values using functions such as Join, Mid, Replace, NormalizeDiacritics, etc.
- Wrap those candidates in SelectUniqueValue(...).
- The provisioning service checks each candidate in order against the target directory and returns the first value that is not already in use.
Examples in the documentation show patterns like:
- First initial + last name, then add numeric suffixes for duplicates.
- Increase the number of characters from the first name when duplicates are found (e.g., canderson → chanderson → chranderson).
- For Workday/SuccessFactors, similar logic is used to generate unique sAMAccountName values while respecting length and character rules.
This mechanism can be adapted to many patterns (e.g., more characters from first name, adding numbers, or alternative combinations), but the expression language does not provide a built‑in way to automatically “start decreasing the letters of lastname” after exhausting all first‑name expansions. That behavior would have to be encoded explicitly as separate candidate rules if needed.
Behavior of SelectUniqueValue when out of candidates
SelectUniqueValue works as follows:
- It evaluates each argument (each is a complete expression that produces one candidate value).
- For each candidate, it checks the target directory/app for uniqueness.
- The first candidate that is unique is returned.
- If all candidate values already exist, the entry is escrowed and the reason is logged in the audit logs.
Important points from the documentation:
- SelectUniqueValue must be at the top level and cannot be nested.
- It is only for entry creation and only for specific provisioning scenarios (Workday→AD, SuccessFactors→AD, API‑driven provisioning to on‑premises AD).
- It cannot be used on attributes with matching precedence.
Regarding the “out of letters” scenario (e.g., a 3‑letter name but logic that conceptually “checks up to 5 letters”):
- The function does not “keep repeating the same old values.”
- It does not automatically generate more candidates than are explicitly provided.
- If the expressions for each argument all evaluate to values that are already present in the target directory, SelectUniqueValue will not return a value; instead, the provisioning entry is escrowed and the failure reason is logged.
So if the expression is written such that only a finite set of candidates can be produced (e.g., all based on a 3‑letter name) and all of those are taken, SelectUniqueValue stops after those candidates and the object is escrowed; it does not loop or repeat.
For patterns that must handle short names, additional candidate rules (for example, adding numeric suffixes or other transformations) should be added explicitly to the SelectUniqueValue argument list.
References:
- Reference for writing expressions for attribute mappings in Microsoft Entra ID
- Workday expression mapping functions for Microsoft Entra ID provisioning
- SuccessFactors expression mapping functions for Microsoft Entra ID provisioning
- Govern on-premises Active Directory users that are provisioned from and managed in Workday.
- Writing expressions for attribute mappings in Microsoft Entra ID