Create Attribute Transform on Source Policy

Hello All,

We are trying to create a temp password for AD on a the create policy but i keep getting some formatting errors with too many commas or not enough. can someone take a look and help us out? The password gets the first name letter, last name and todays start date and puts it in as the password of AD.

I am open to easier ways, I cannot use power shell at this time so thus this logic

 {    
          "name": "password",
          "transform": {
           "type": "usernameGenerator",
           "attributes": {
        "patterns": [
            "$combined"
        ],
        "combined": {
            "type": "substring",
            "attributes": {
                "begin": 0,
                "end": 9,
                "input": {
                    "type": "static",
                    "attributes": {
                        "value": "$fi$ln$dd",
                        "ln": {
                            "type": "identityAttribute",
                            "attributes": {
                                "name": "lastname"
                            }
                        },
                        "fi": {
                            "type": "substring",
                            "attributes": {
                                "input": {
                                    "type": "identityAttribute",
                                    "attributes": {
                                        "name": "firstname"
                                    }
                                },
                                "begin": 0,
                                "end": 1
                            }
                        },
                        "dd": {
                            "type": "dateFormat",
                            "attributes": {
                                "input": {
                                    "type": "identityAttribute",
                                    "attributes": {
                                        "name": "startDate"
                                    }
                                },
                                "inputFormat": "mm-dd-yyyy",
                                "outputFormat": "MMddyyyy"
                            }
                        }
                    }
                }
            }
        }
    },
                "attributes": {},
                "isRequired": false,
                "type": "string",
                "isMultiValued": false
            },

Your transform seems to have missing a closing “}” and at the end you have an extra comma.
You can use a static type transform to achieve this use case.

{
    "name": "password",
    "transform": {
        "type": "usernameGenerator",
        "attributes": {
            "patterns": [
                "$combined"
            ],
            "combined": {
                "type": "substring",
                "attributes": {
                    "begin": 0,
                    "end": 9,
                    "input": {
                        "type": "static",
                        "attributes": {
                            "value": "$fi$ln$dd",
                            "ln": {
                                "type": "identityAttribute",
                                "attributes": {
                                    "name": "lastname"
                                }
                            },
                            "fi": {
                                "type": "substring",
                                "attributes": {
                                    "input": {
                                        "type": "identityAttribute",
                                        "attributes": {
                                            "name": "firstname"
                                        }
                                    },
                                    "begin": 0,
                                    "end": 1
                                }
                            },
                            "dd": {
                                "type": "dateFormat",
                                "attributes": {
                                    "input": {
                                        "type": "identityAttribute",
                                        "attributes": {
                                            "name": "startDate"
                                        }
                                    },
                                    "inputFormat": "mm-dd-yyyy",
                                    "outputFormat": "MMddyyyy"
                                }
                            }
                        }
                    }
                }
            }
        },
        "isRequired": false,
        "isMultiValued": false
    }
}

Try this

Hello,

You can use the below example as well of static transform where I have calculated multiple password strings individually and then concatenated them at the end. Refer the below transform example.

{
    "name": "Test-ActiveDirectory-Transform-Password",
    "type": "static",
    "attributes": {
        "GetFirstNameFirstLetter": {
            "type": "substring",
            "attributes": {
                "input": {
                    "attributes": {
                        "name": "firstname"
                    },
                    "type": "identityAttribute"
                },
                "begin": 0,
                "end": 1
            }
        },
        "GetLastName": {
            "attributes": {
                "name": "lastname"
            },
            "type": "identityAttribute"
        },
        "GetTodaysDate": {
            "type": "dateFormat",
            "attributes": {
                "input": {
                    "attributes": {
                        "input": "",
                        "expression": "now",
                        "roundUp": false
                    },
                    "type": "dateMath"
                },
                "inputFormat": "ISO8601",
                "outputFormat": "ddmmyyyy"
            }
        },
        "value": "$GetFirstNameFirstLetter$GetLastName$GetTodaysDate"
    }
}
1 Like

The problem, comes with this is that we need to create the logic that gives the first letter of the first name, last name plus 3 and then the create date as the string password

If you have sample that would be great

Hello,

Lets take an Example.

First Name : Tony
Last Name : John
Create Date : 30-09-2024

Then, password which you have to create is : TJohn330092024, is it correct assumption?