You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/active-directory/app-provisioning/functions-for-customizing-application-data.md
+58-29Lines changed: 58 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ ms.reviewer: arvinh
15
15
16
16
# Reference for writing expressions for attribute mappings in Azure Active Directory
17
17
18
-
When you configure provisioning to a SaaS application, one of the types of attribute mappings that you can specify is an expression mapping. For these, you must write a script-like expression that allows you to transform your users' data into formats that are more acceptable for the SaaS application.
18
+
When you configure provisioning to a SaaS application, one of the types of attribute mappings that you can specify is an expression mapping. For these mappings, you must write a script-like expression that allows you to transform your users' data into formats that are more acceptable for the SaaS application.
19
19
20
20
## Syntax overview
21
21
@@ -34,7 +34,7 @@ The syntax for Expressions for Attribute Mappings is reminiscent of Visual Basic
@@ -54,7 +54,7 @@ Takes a source string value and appends the suffix to the end of it.
54
54
55
55
56
56
#### Append constant suffix to user name
57
-
Example: If you are using a Salesforce Sandbox, you might need to append an additional suffix to all your user names before synchronizing them.
57
+
Example: If you are using a Salesforce Sandbox, you might need to append another suffix to all your user names before synchronizing them.
58
58
59
59
**Expression:**
60
60
`Append([userPrincipalName], ".test")`
@@ -96,8 +96,8 @@ In other words, it returns 0 in all cases except when the corresponding bits of
96
96
97
97
| Name | Required/ Repeating | Type | Notes |
98
98
| --- | --- | --- | --- |
99
-
|**value1**|Required |num|Numeric value that should be AND'ed with value2|
100
-
|**value2**|Required |num|Numeric value that should be AND'ed with value1|
99
+
|**value1**|Required |Num|Numeric value that should be AND'ed with value2|
100
+
|**value2**|Required |Num|Numeric value that should be AND'ed with value1|
101
101
102
102
**Example:**
103
103
`BitAnd(&HF, &HF7)`
@@ -116,7 +116,7 @@ In other words, it returns 0 in all cases except when the corresponding bits of
116
116
117
117
| Name | Required/ Repeating | Type | Notes |
118
118
| --- | --- | --- | --- |
119
-
|**expression**|Required | expression | Any valid expression |
119
+
|**Expression**|Required | expression | Any valid expression |
120
120
121
121
**Example:**
122
122
`CBool([attribute1] = [attribute2])`
@@ -134,7 +134,7 @@ The CDate function returns a UTC DateTime from a string. DateTime is not a nativ
134
134
135
135
| Name | Required/ Repeating | Type | Notes |
136
136
| --- | --- | --- | --- |
137
-
|**expression**|Required |expression| Any valid string that represents a date/time. For supported formats, refer to [.NET custom date and time format strings](/dotnet/standard/base-types/custom-date-and-time-format-strings). |
137
+
|**Expression**|Required |Expression| Any valid string that represents a date/time. For supported formats, refer to [.NET custom date and time format strings](/dotnet/standard/base-types/custom-date-and-time-format-strings). |
138
138
139
139
**Remarks:**
140
140
The returned string is always in UTC and follows the format **M/d/yyyy h:mm:ss tt**.
@@ -289,22 +289,22 @@ The **interval** string must have one of the following values:
289
289
***INPUT** (StatusHireDate): 2012-03-16-07:00
290
290
***OUTPUT**: 3/23/2012 7:00:00 AM
291
291
292
-
**Example 2: Get a date 10 days prior to hire date**
292
+
**Example 2: Get a date ten days prior to hire date**
293
293
`DateAdd("d", -10, CDate([StatusHireDate]))`
294
294
***INPUT** (StatusHireDate): 2012-03-16-07:00
295
295
***OUTPUT**: 3/6/2012 7:00:00 AM
296
296
297
-
**Example 3: Add 2 weeks to hire date**
297
+
**Example 3: Add two weeks to hire date**
298
298
`DateAdd("ww", 2, CDate([StatusHireDate]))`
299
299
***INPUT** (StatusHireDate): 2012-03-16-07:00
300
300
***OUTPUT**: 3/30/2012 7:00:00 AM
301
301
302
-
**Example 4: Add 10 months to hire date**
302
+
**Example 4: Add ten months to hire date**
303
303
`DateAdd("m", 10, CDate([StatusHireDate]))`
304
304
***INPUT** (StatusHireDate): 2012-03-16-07:00
305
305
***OUTPUT**: 1/16/2013 7:00:00 AM
306
306
307
-
**Example 5: Add 2 years to hire date**
307
+
**Example 5: Add two years to hire date**
308
308
`DateAdd("yyyy", 2, CDate([StatusHireDate]))`
309
309
***INPUT** (StatusHireDate): 2012-03-16-07:00
310
310
***OUTPUT**: 3/16/2014 7:00:00 AM
@@ -352,7 +352,7 @@ The **interval** string must have one of the following values:
352
352
| Difference in seconds between two dates | s | 2021-08-24 | 2021-08-25 | 86400 |
353
353
354
354
**Example 2: Combine DateDiff with IIF function to set attribute value** <br>
355
-
If an account is Active in Workday, set the *accountEnabled* attribute of the user to True only if hire date is within the next 5 days.
355
+
If an account is Active in Workday, set the *accountEnabled* attribute of the user to True only if hire date is within the next five days.
356
356
357
357
```
358
358
Switch([Active], ,
@@ -438,7 +438,7 @@ The IgnoreFlowIfNullOrEmpty function instructs the provisioning service to ignor
438
438
439
439
| Name | Required/ Repeating | Type | Notes |
440
440
| --- | --- | --- | --- |
441
-
|**expression**| Required |expression| Expression to be evaluated |
441
+
|**Expression**| Required |Expression| Expression to be evaluated |
442
442
443
443
**Example 1: Don't flow an attribute if it is null** <br>
444
444
`IgnoreFlowIfNullOrEmpty([department])` <br>
@@ -506,7 +506,7 @@ If the expression evaluates to Null, then the IsNull function returns true. For
506
506
507
507
| Name | Required/ Repeating | Type | Notes |
508
508
| --- | --- | --- | --- |
509
-
|**expression**|Required |expression|Expression to be evaluated |
509
+
|**Expression**|Required |Expression|Expression to be evaluated |
510
510
511
511
**Example:**
512
512
`IsNull([displayName])`
@@ -526,7 +526,7 @@ The inverse of this function is named IsPresent.
526
526
527
527
| Name | Required/ Repeating | Type | Notes |
528
528
| --- | --- | --- | --- |
529
-
|**expression**|Required |expression|Expression to be evaluated |
529
+
|**Expression**|Required |Expression|Expression to be evaluated |
530
530
531
531
**Example:**
532
532
`IsNullOrEmpty([displayName])`
@@ -545,7 +545,7 @@ If the expression evaluates to a string that is not Null and is not empty, then
545
545
546
546
| Name | Required/ Repeating | Type | Notes |
547
547
| --- | --- | --- | --- |
548
-
|**expression**|Required |expression|Expression to be evaluated |
548
+
|**Expression**|Required |Expression|Expression to be evaluated |
@@ -562,7 +562,7 @@ If the expression can be evaluated to a string type, then the IsString function
562
562
563
563
| Name | Required/ Repeating | Type | Notes |
564
564
| --- | --- | --- | --- |
565
-
|**expression**|Required |expression|Expression to be evaluated |
565
+
|**Expression**|Required |Expression|Expression to be evaluated |
566
566
567
567
---
568
568
### Item
@@ -602,7 +602,7 @@ If one of the source values is a multi-value attribute, then every value in that
602
602
---
603
603
### Left
604
604
**Function:**
605
-
Left(String,NumChars)
605
+
Left(String,NumChars)
606
606
607
607
**Description:**
608
608
The Left function returns a specified number of characters from the left of a string.
@@ -636,8 +636,8 @@ Returns a substring of the source value. A substring is a string that contains o
636
636
| Name | Required/ Repeating | Type | Notes |
637
637
| --- | --- | --- | --- |
638
638
|**source**|Required |String |Usually name of the attribute. |
639
-
|**start**|Required |integer|Index in the **source** string where substring should start. First character in the string will have index of 1, second character will have index 2, and so on. |
640
-
|**length**|Required |integer|Length of the substring. If length ends outside the **source** string, function will return substring from **start** index till end of **source** string. |
639
+
|**start**|Required |Integer|Index in the **source** string where substring should start. First character in the string will have index of 1, second character will have index 2, and so on. |
640
+
|**length**|Required |Integer|Length of the substring. If length ends outside the **source** string, function will return substring from **start** index untill end of **source** string. |
641
641
642
642
---
643
643
### NormalizeDiacritics
@@ -677,7 +677,7 @@ Requires one string argument. Returns the string, but with any diacritical chara
677
677
678
678
679
679
#### Remove diacritics from a string
680
-
Example: You need to replace characters containing accent marks with equivalent characters that don't contain accent marks.
680
+
Example: Replace characters containing accent marks with equivalent characters that don't contain accent marks.
681
681
682
682
**Expression:**
683
683
NormalizeDiacritics([givenName])
@@ -730,11 +730,11 @@ The NumFromDate function converts a DateTime value to Active Directory format th
730
730
731
731
**Example:**
732
732
* Workday example
733
-
Assuming you want to map the attribute *ContractEndDate* from Workday which is in the format *2020-12-31-08:00* to *accountExpires* field in AD, here is how you can use this function and change the timezone offset to match your locale.
733
+
Assuming you want to map the attribute *ContractEndDate* from Workday, which is in the format *2020-12-31-08:00* to *accountExpires* field in AD, here is how you can use this function and change the timezone offset to match your locale.
Assuming you want to map the attribute *endDate* from SuccessFactors which is in the format *M/d/yyyy hh:mm:ss tt* to *accountExpires* field in AD, here is how you can use this function and change the time zone offset to match your locale.
737
+
Assuming you want to map the attribute *endDate* from SuccessFactors, which is in the format *M/d/yyyy hh:mm:ss tt* to *accountExpires* field in AD, here is how you can use this function and change the time zone offset to match your locale.
@@ -782,6 +782,35 @@ Let's say you are sourcing the attributes *firstName* and *lastName* from SAP Su
782
782
|`PCase(Join(" ",[firstName],[lastName]))`|*firstName* = GREGORY, *lastName* = "JAMES" | "Gregory James" | You can nest the Join function within PCase. As the *wordSeparators* parameter is not specified, the *PCase* function uses the default word separators character set. |
The RandomString function generates a random string based on the conditions specified. Characters allowed can be identified [here](https://docs.microsoft.com/windows/security/threat-protection/security-policy-settings/password-must-meet-complexity-requirements#reference).
793
+
794
+
**Parameters:**
795
+
796
+
| Name | Required/ Repeating | Type | Notes |
797
+
| --- | --- | --- | --- |
798
+
|**Length**|Required |Number |Total length of the random string. This should be greater than or equal to the sum of MinimumNumbers, MinimumSpecialCharacters, and MinimumCapital. 256 characters max.|
799
+
|**MinimumNumbers**|Required |Number |Minimum numbers in the random string.|
800
+
|**MinimumSpecialCharacters**|Required |Number |Minimum number of special characters.|
801
+
|**MinimumCapital**|Required |Number |Minimum number of capital letters in the random string.|
802
+
|**MinimumLowerCase**|Required |Number |Minimum number of lower case letters in the random string.|
803
+
|**CharactersToAvoid**|Optional |String |Characters to be excluded when generating the random string.|
804
+
805
+
806
+
**Example 1:** - Generate a random string without special character restrictions:
807
+
`RandomString(6,3,0,0,3)`
808
+
Generates a random string with 6 characters. The string contains 3 numbers and 3 lower case characters (1a73qt).
809
+
810
+
**Example 2:** - Generate a random string with special character restrictions:
811
+
`RandomString(10,2,2,2,1,"?,")`
812
+
Generates a random string with 10 characters. The string contains at least 2 numbers, 2 special characters, 2 capital letters, 1 lower case letter and excludes the characters "?" and "," (1@!2BaRg53).
Requires a minimum of two arguments, which are unique value generation rules defined using expressions. The function evaluates each rule and then checks the value generated for uniqueness in the target app/directory. The first unique value found will be the one returned. If all of the values already exist in the target, the entry will get escrowed and the reason gets logged in the audit logs. There is no upper bound to the number of arguments that can be provided.
861
890
862
891
863
-
- This is a top-level function, it cannot be nested.
892
+
- This function must be at the top-level and cannot be nested.
864
893
- This function cannot be applied to attributes that have a matching precedence.
865
894
- This function is only meant to be used for entry creations. When using it with an attribute, set the **Apply Mapping** property to **Only during object creation**.
866
895
- This function is currently only supported for "Workday to Active Directory User Provisioning" and "SuccessFactors to Active Directory User Provisioning". It cannot be used with other provisioning applications.
@@ -902,7 +931,7 @@ Example: Based on the user's first name, middle name and last name, you need to
902
931
SingleAppRoleAssignment([appRoleAssignments])
903
932
904
933
**Description:**
905
-
Returns a single appRoleAssignment from the list of all appRoleAssignments assigned to a user for a given application. This function is required to convert the appRoleAssignments object into a single role name string. Note that the best practice is to ensure only one appRoleAssignment is assigned to one user at a time, and if multiple roles are assigned the role string returned may not be predictable.
934
+
Returns a single appRoleAssignment from the list of all appRoleAssignments assigned to a user for a given application. This function is required to convert the appRoleAssignments object into a single role name string. The best practice is to ensure only one appRoleAssignment is assigned to one user at a time, and if multiple roles are assigned the role string returned may not be predictable.
906
935
907
936
**Parameters:**
908
937
@@ -969,7 +998,7 @@ When **source** value matches a **key**, returns **value** for that **key**. If
969
998
|**value**|Required |String |Replacement value for the **source** matching the key. |
970
999
971
1000
#### Replace a value based on predefined set of options
972
-
Example: You need to define the time zone of the user based on the state code stored in Azure AD.
1001
+
Example: Define the time zone of the user based on the state code stored in Azure AD.
973
1002
If the state code doesn't match any of the predefined options, use default value of "Australia/Sydney".
974
1003
975
1004
**Expression:**
@@ -1018,7 +1047,7 @@ ToUpper(source, culture)
1018
1047
**Description:**
1019
1048
Takes a *source* string value and converts it to upper case using the culture rules that are specified. If there is no *culture* info specified, then it will use Invariant culture.
1020
1049
1021
-
If you would like to set existing values in the target system to upper case, please [update the schema for your target application](./customize-application-attributes.md#editing-the-list-of-supported-attributes) and set the property caseExact to 'true' for the attribute that you are interested in.
1050
+
If you would like to set existing values in the target system to upper case, [update the schema for your target application](./customize-application-attributes.md#editing-the-list-of-supported-attributes) and set the property caseExact to 'true' for the attribute that you are interested in.
1022
1051
1023
1052
**Parameters:**
1024
1053
@@ -1062,7 +1091,7 @@ Returns "has".
1062
1091
This section provides more expression function usage examples.
1063
1092
1064
1093
### Strip known domain name
1065
-
You need to strip a known domain name from a user's email to obtain a user name.
1094
+
Strip a known domain name from a user's email to obtain a user name.
1066
1095
For example, if the domain is "contoso.com", then you could use the following expression:
1067
1096
1068
1097
**Expression:**
@@ -1075,7 +1104,7 @@ For example, if the domain is "contoso.com", then you could use the following ex
1075
1104
1076
1105
1077
1106
### Generate user alias by concatenating parts of first and last name
1078
-
You need to generate a user alias by taking first 3 letters of user's first name and first 5 letters of user's last name.
1107
+
Generate a user alias by taking first three letters of user's first name and first five letters of user's last name.
0 commit comments