Skip to content

Instantly share code, notes, and snippets.

@ravikyada
Created December 11, 2023 13:00
Show Gist options
  • Save ravikyada/b4afd0abf1865d3a480689fdb3ef9d25 to your computer and use it in GitHub Desktop.
Save ravikyada/b4afd0abf1865d3a480689fdb3ef9d25 to your computer and use it in GitHub Desktop.
Create Jenkins User with Script Console
import jenkins.model.*
import hudson.security.*
def instance = Jenkins.getInstance()
def hudsonRealm = new HudsonPrivateSecurityRealm(false)
hudsonRealm.createAccount("USERNAME","PASSWORD")
instance.setSecurityRealm(hudsonRealm)
instance.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment