'How to create users and passwords for Jenkins using JCASC

I am trying to create a user and password for Jenkins using JCASC. I can set up Jenkins however when I go to the GUI on my local host I do not see any users. Here is my code

jenkins:
  systemMessage: "Jenkins configured automatically by Jenkins Configuration as Code plugin\n\n"
  disabledAdministrativeMonitors:
      - "jenkins.diagnostics.ControllerExecutorsNoAgents"
credentials:
  system:
    domainCredentials:
    - credentials:
      - usernamePassword:
          id: "admin-cred"
          username: "jenkins-admin"
          password: "butler"
          scope: GLOBAL

I believe I have all the necessary plugins installed but something is missing clearly. Any help would be appreciated.



Solution 1:[1]

The way I got users to pop up is by setting up the (local) security realm, rather than credentials, like so:

jenkins:
  securityRealm:
    local:
      users:
       - id: jenkins-admin
         password: butler

I'm finding this a great resource to get ideas from: https://github.com/oleg-nenashev/demo-jenkins-config-as-code

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nico Villanueva