I have integrated Jenkins with Azure AD and it is working fine without any issue. Now i want to trigger jenkins job remotely. Previously i was using the jenkins username and password with curl it was working fine with the below command but now im using my Azure AD mail id and jenkins token it is not working. curl -X POST https://{name}.{org name}.com/job/[job name]/build --user jenkins_user:jenkins_user_token
Kindly help on how to do this with Azure AD Auth
Which command need to be used to trigger the jenkins job which is integrated with Azure AD
is that possible to create using powershell or batch or shell or python
When Jenkins is integrated with Azure AD for authentication, I think youāll need to use an access token or a personal access token (PAT) for triggering Jenkins jobs remotely instead of a username and password.
PATs are typically used when you have integrated Jenkins with Azure AD and cannot access username and password authentication.
Hereās how you could trigger a Jenkins job using cURL with a PAT:
curl -X POST https://{name}.{org name}.com/job/[job name]/build \
--user jenkins_user:{your_personal_access_token}
Replace {name}.{org name} with your Jenkins URL, [job name] with the name of the job you want to trigger, jenkins_user with your Jenkins username, and {your_personal_access_token} with your personal access token.
When you go to your user in Jenkins UI, what does it show as Jenkins User ID? Is it your mailid or some other id.
Have you granted the permissions to your mailid or some other id for accessing the job?
Jenkins User ID: d4a74085-6d97-47ea-9166-8e7ba2d1363a
The thing at the right side of āJenkins User IDā is what you should use in the curl command. In my environment, it is the same as the āObject IDā shown above it. I have disabled Graph API integration in the Azure AD plugin though; I donāt know whether the format of the Jenkins User ID would change if I enabled that.
Hello, was wondering if you guys got it working without using an personal access token, and if so how was the actual procedure , we are also trying to generate an API Token via curl command with Azure AD auth enabled and the documentation seems to be lacking for that use-case.
If needed I can also start a new thread about this matter
But why do we need to use Jenkins User ID?
Earlier the curl call with below parameters used to work
curl -u ātest@abc.aiā:āhttps://myjenkins.abc.com/api/jsonā