Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

AD Password Generation

GPS
New Contributor II
New Contributor II

Hello All,

I am trying to set a password while creating an AD account.

syntax: 
Screenshot 2024-05-01 at 12.22.33 PM.png

"unicodePwd": "${'PasswordCo' + ((new Date().getMonth() + 1).toString().padStart(2, '0')) + (new Date().getFullYear().toString().slice(-2)) + (Math.floor(1000 + Math.random() * 9000))}",



I am seeing below errors in the logs if i use this above syntax.

2024-05-01T11:48:31-05:00-ecm-worker-ldap.SaviyntGroovyLdapService-quartzScheduler_Worker-7-9pc8v-ERROR-Error while creating account in AD - CN=1000149,OU=SupportCenter,OU=Users,OU=P,DC=pcorp,DC=net: [LDAP: error code 34 - 00002081: NameErr: DSID-03050F42, problem 2003 (BAD_ATT_SYNTAX), data 0, best match of:| 'CN=1000149,OU=SupportCenter,OU=Users,OU=P,DC=pcorp,DC=net'|]
 
2024-05-01T11:48:32-05:00-ecm-worker--null-9pc8v--javax.naming.InvalidNameException: CN=1000149,OU=SupportCenter,OU=Users,OU=P,DC=pcorp,DC=net: [LDAP: error code 34 - 00002081: NameErr: DSID-03050F42, problem 2003 (BAD_ATT_SYNTAX), data 0, best match of:




5 REPLIES 5

Saathvik
All-Star
All-Star

@GPS : If you remove password mapping is it working fine? Can you share the CreateAccountJSON?


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

GPS
New Contributor II
New Contributor II

@Saathvik 
Yes if i remove the password and set a random password/hardcoded password it is working.

{
	"cn":"${cn}",
	"givenname": "${user.firstname}",
	"displayname": "${user.firstname} ${user.lastname}",
	"userAccountControl": "512",
	"sAMAccountName": "${task.accountName}",
	"sn": "${user.lastname}",
	"pwdLastSet": "0",
	"userPrincipalName": "${task.accountName}@pcorp.net",
	"unicodePwd": "PasswordCo05244692",
	"extensionattribute9": "${user.customproperty9}",
	"AMFeffectivedate": "${user.customproperty8}",
	"title": "${user.customproperty24}",
	"department": "${user.departmentname}",
	"employeeNumber": "${user.username}",
	"employeeID": "${user.username}",
	"name": "${user.username}",
	"objectClass": [
		"top",
		"person",
		"organizationalPerson",
		"user"
	]
}

@GPS : Please remove CN mapping and see if that works. If still not working then I believe issue with new Date(), Instead of it use calendar instance

Replace new Date().getMonth() with Calendar.getInstance().get(Calendar.MONTH

new Date().getFullYear() with Calendar.getInstance().get(Calendar.YEAR)


Regards,
Saathvik
If this reply answered your question, please Accept As Solution and give Kudos to help others facing similar issue.

PremMahadikar
All-Star
All-Star

Hi @GPS ,

Can you once try removing - "cn":"${cn}" 

 

rushikeshvartak
All-Star
All-Star

 new String("\"PasswordCo${(new Date().getMonth() + 1).toString().padLeft(2, '0')}${(new Date().format('yy'))}${(1000..9999).collect{it}.shuffle().first()}\"".getBytes("UTF-16LE").encodeBase64())


Regards,
Rushikesh Vartak
If you find this response useful, kindly consider selecting 'Accept As Solution' and clicking on the 'Kudos' button.