Remove spaces in lastname in account provisioning policy in entra

Currently working Entra ID in Sailpoint ISC, I have created a custom transform for UPN and mailnickName, Few accounts got created in entra, few not. I found the issue, There are some spaces in lastname. Due to that account creation not happened its failed. I have created a username geerator for UPN and mailnick Name, also tried repalceall transform to remove space, Still didn’t work. Please find the attched provisioning plan for the identity.

{

        "name": "userPrincipalName",

        "transform": {

            "type": "usernameGenerator",

            "attributes": {

                "sourceCheck": true,

                "patterns": \[

                    "ADM$firstname$lastname@ChubbGlobal.onmicrosoft.com",

                    "ADM$firstname$lastname$uniqueCounter@ChubbGlobal.onmicrosoft.com"

                \],

                "firstname": {

                    "type": "replaceAll",

                    "attributes": {

                        "input": {

                            "type": "identityAttribute",

                            "attributes": {

                                "name": "firstname"

                            }

                        },

                        "regex": "\\\\s+",

                        "replacement": ""

                    }

                },

                "lastname": {

                    "type": "replaceAll",

                    "attributes": {

                        "input": {

                            "type": "identityAttribute",

                            "attributes": {

                                "name": "lastname"

                            }

                        },

                        "regex": "\\\\s+",

                        "replacement": ""

                    }

                }

            }

        },

        "attributes": {

            "cloudMaxUniqueChecks": "5",

            "cloudMaxSize": "100",

            "cloudRequired": "true"

        },

        "isRequired": true,

        "type": "string",

        "isMultiValued": false

    },

{

        "name": "mailNickname",

        "transform": {

            "type": "usernameGenerator",

            "attributes": {

                "sourceCheck": true,

                "patterns": \[

                    "ADM$firstname$lastname",

                    "ADM$firstname$lastname$uniqueCounter"

                \],

                "firstname": {

                    "type": "replaceAll",

                    "attributes": {

                        "input": {

                            "type": "identityAttribute",

                            "attributes": {

                                "name": "firstname"

                            }

                        },

                        "regex": "\\\\s+",

                        "replacement": ""

                    }

                },

                "lastname": {

                    "type": "replaceAll",

                    "attributes": {

                        "input": {

                            "type": "identityAttribute",

                            "attributes": {

                                "name": "lastname"

                            }

                        },

                        "regex": "\\\\s+",

                        "replacement": ""

                    }

                }

            }

        },

        "attributes": {

            "cloudMaxUniqueChecks": "5",

            "cloudMaxSize": "100",

            "cloudRequired": "true"

        },

        "isRequired": true,

        "type": "string",

        "isMultiValued": false

    },

Please need your inputs to solve this issue.

Hi @ravikumar7284 ,

Could you try adding a trim transform to both the firstname and lastname attributes and then test again?

For reference, you can use the transform snippet below:

"firstname": {
"attributes": {
"input": {
"type": "replaceAll",
"attributes": {
"input": {
"type": "identityAttribute",
"attributes": {
"name": "firstname"
}
},
"regex": "\s+",
"replacement": ""
}
}
},
"type": "trim"
},
"lastname": {
"attributes": {
"input": {
"type": "replaceAll",
"attributes": {
"input": {
"type": "identityAttribute",
"attributes": {
"name": "lastname"
}
},
"regex": "\s+",
"replacement": ""
}
}
},
"type": "trim"
}

Hi @suraj_gorle ,Thank you for your time. I tried that what you suggested still the space issue not resolved.

Hi @ravikumar7284 ,
can you try below
{
"attributes": {
"input": {
"type": "replaceAll",
"attributes": {
"input": {
"type": "identityAttribute",
"attributes": {
"name": "lastname"
}
},
"regex": "\\s+",
"replacement": ""
}
}
},
"type": "trim"
}
If that regex is not working please try below

1. "regex": " ",
"replacement": ""

2. "regex": "" +"",
"replacement": ""

3.  "regex": ""[ ]+"",
"replacement": ""

Let me know result.
Thank you.

Hi @ravikumar7284 ,

Try with this regex: [\s\u00A0]+

Example:
lastname: Van Der Berg

regex result : VanDerBerg

Hi @Bapu-Gogu , I tried what you suggested. Please find the attached screenshot of provisioning plan and UPN and mailNickname transform code.


{

        "name": "mailNickname",

        "transform": {

            "type": "usernameGenerator",

            "attributes": {

                "sourceCheck": true,

                "patterns": \[

                    "ADM$firstname$lastname",

                    "ADM$firstname$lastname$uniqueCounter"

                \],

                "firstname": {

                    "attributes": {

                        "input": {

                            "type": "replaceAll",

                            "attributes": {

                                "input": {

                                    "type": "identityAttribute",

                                    "attributes": {

                                        "name": "firstname"

                                    }

                                },

                                "regex": "\[\\\\s\\\\u00A0\]+"

                            }

                        }

                    }

                },

                "lastname": {

                    "attributes": {

                        "input": {

                            "type": "replaceAll",

                            "attributes": {

                                "input": {

                                    "type": "identityAttribute",

                                    "attributes": {

                                        "name": "lastname"

                                    }

                                },

                                "regex": "\[\\\\s\\\\u00A0\]+"

                            }

                        }

                    }

                }

            }

        },

        "attributes": {

            "cloudMaxUniqueChecks": "5",

            "cloudMaxSize": "100",

            "cloudRequired": "true"

        },

        "isRequired": true,

        "type": "string",

        "isMultiValued": false

    },

{

        "name": "userPrincipalName",

        "transform": {

            "type": "usernameGenerator",

            "attributes": {

                "sourceCheck": true,

                "patterns": \[

                    "ADM$firstname$lastname@ChubbGlobal.onmicrosoft.com",

                    "ADM$firstname$lastname$uniqueCounter@ChubbGlobal.onmicrosoft.com"

                \],

                "firstname": {

                    "attributes": {

                        "input": {

                            "type": "replaceAll",

                            "attributes": {

                                "input": {

                                    "type": "identityAttribute",

                                    "attributes": {

                                        "name": "firstname"

                                    }

                                },

                                "regex": "\[\\\\s\\\\u00A0\]+"

                            }

                        }

                    }

                },

                "lastname": {

                    "attributes": {

                        "input": {

                            "type": "replaceAll",

                            "attributes": {

                                "input": {

                                    "type": "identityAttribute",

                                    "attributes": {

                                        "name": "lastname"

                                    }

                                },

                                "regex": "\[\\\\s\\\\u00A0\]+"

                            }

                        }

                    }

                }

            }

        },

        "attributes": {

            "cloudMaxUniqueChecks": "5",

            "cloudMaxSize": "100",

            "cloudRequired": "true"

        },

        "isRequired": true,

        "type": "string",

        "isMultiValued": false

    },

can you try this, fix is transform above written is incorrect format.

{

    "name": "userPrincipalName",

    "transform": {

        "type": "usernameGenerator",

        "attributes": {

            "sourceCheck": true,

            "patterns": [

                "ADM$firstname$lastname@ChubbGlobal.onmicrosoft.com",

                "ADM$firstname$lastname$uniqueCounter@ChubbGlobal.onmicrosoft.com"

            ],

            "firstname": {

                "type": "replaceAll",

                "attributes": {

                    "input": {

                        "type": "identityAttribute",

                        "attributes": {

                            "name": "firstname"

                        }

                    },

                    "table": {

                        "[\\s\\p{Z}]+": ""

                    }

                }

            },

            "lastname": {

                "type": "replaceAll",

                "attributes": {

                    "input": {

                        "type": "identityAttribute",

                        "attributes": {

                            "name": "lastname"

                        }

                    },

                    "table": {

                        "[\\s\\p{Z}]+": ""

                    }

                }

            }

        }

    },

    "attributes": {

        "cloudMaxUniqueChecks": "5",

        "cloudMaxSize": "100",

        "cloudRequired": "true"

    },

    "isRequired": true,

    "type": "string",

    "isMultiValued": false

},

{

    "name": "mailNickname",

    "transform": {

        "type": "usernameGenerator",

        "attributes": {

            "sourceCheck": true,

            "patterns": [

                "ADM$firstname$lastname",

                "ADM$firstname$lastname$uniqueCounter"

            ],

            "firstname": {

                "type": "replaceAll",

                "attributes": {

                    "input": {

                        "type": "identityAttribute",

                        "attributes": {

                            "name": "firstname"

                        }

                    },

                    "table": {

                        "[\\s\\p{Z}]+": ""

                    }

                }

            },

            "lastname": {

                "type": "replaceAll",

                "attributes": {

                    "input": {

                        "type": "identityAttribute",

                        "attributes": {

                            "name": "lastname"

                        }

                    },

                    "table": {

                        "[\\s\\p{Z}]+": ""

                    }

                }

            }

        }

    },

    "attributes": {

        "cloudMaxUniqueChecks": "5",

        "cloudMaxSize": "100",

        "cloudRequired": "true"

    },

    "isRequired": true,

    "type": "string",

    "isMultiValued": false

}

Hi @ravikumar7284

Can you try bellow transforms please. I used replace transform instead of replaceAll inside the username generator.

userPrincipalName

{
“name”: “userPrincipalName”,
“transform”: {
“type”: “usernameGenerator”,
“attributes”: {
“sourceCheck”: true,
“patterns”: [
“ADM$fn$ln@ChubbGlobal.onmicrosoft.com”,
“ADM$fn$ln${uniqueCounter}@ChubbGlobal.onmicrosoft.com”
],
“fn”: {
“type”: “replace”,
“attributes”: {
“input”: {
“type”: “identityAttribute”,
“attributes”: {
“name”: “firstname”
}
},
“regex”: “\s+”,
“replacement”: “”
}
},
“ln”: {
“type”: “replace”,
“attributes”: {
“input”: {
“type”: “identityAttribute”,
“attributes”: {
“name”: “lastname”
}
},
“regex”: “\s+”,
“replacement”: “”
}
}
}
},
“attributes”: {
“cloudMaxUniqueChecks”: “5”,
“cloudMaxSize”: “100”,
“cloudRequired”: “true”
},
“isRequired”: true,
“type”: “string”,
“isMultiValued”: false
}

Transform mailNickname

{
“name”: “mailNickname”,
“transform”: {
“type”: “usernameGenerator”,
“attributes”: {
“sourceCheck”: true,
“patterns”: [
“ADM$fn$ln”,
“ADM$fn$ln${uniqueCounter}”
],
“fn”: {
“type”: “replace”,
“attributes”: {
“input”: {
“type”: “identityAttribute”,
“attributes”: {
“name”: “firstname”
}
},
“regex”: “\s+”,
“replacement”: “”
}
},
“ln”: {
“type”: “replace”,
“attributes”: {
“input”: {
“type”: “identityAttribute”,
“attributes”: {
“name”: “lastname”
}
},
“regex”: “\s+”,
“replacement”: “”
}
}
}
},
“attributes”: {
“cloudMaxUniqueChecks”: “5”,
“cloudMaxSize”: “100”,
“cloudRequired”: “true”
},
“isRequired”: true,
“type”: “string”,
“isMultiValued”: false
}

Hi @Bapu-Gogu , Thank you for your time. I tried the above one. Now its working. Remove spaces from lastname and account got created now. Thank you for your help.

Hi @Bapu-Gogu , I have one more question, you have suggested “table”: {

                    "\[\\\\s\\\\p{Z}\]+": ""

                } It will remove only spaces in first name or last name, How to remove special characters and apostrophe in names. Thanks.

here is the updated regex that removes both whitespace and special characters.

"[\s\p{Z}\p{P}\p{S}]+": ""

Thank you for your response, I have used “[^A-Za-z0-9]”: “” this regx. It removes spaces and apostephes and special characters.