We manage a fleet of Jenkins instances that are secured with Okta SSO (SAML).
Our goal is to programmatically generate API tokens with administrative privileges for a generic service account to support automation workflows across these controllers.
We currently use Matrix-Based Authorization to manage user and group permissions. We attempted to add a generic service account to the existing IAM/IdP group that has administrative rights, but this did not grant admin access inside Jenkins. Since these Jenkins controllers run in production, we cannot restart or modify the security realm.
Questions:
- What is the best way to programmatically create admin-level API tokens for a service account when Jenkins is using an external IdP (Okta/SAML) and does not store local users?
- How can we ensure that a service account reliably receives admin privileges under Matrix-Based Authorization when IdP group membership is not being mapped as expected?
- Is there a recommended or community-supported pattern for managing service accounts and generating API tokens in Jenkins environments secured by Okta SSO?
- Can API tokens be created via Groovy/Jenkins CLI without requiring UI login or a restart?
Any guidance, best practices, or examples from others with similar SAML/Okta Jenkins setups would be greatly appreciated.
Thank you!