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.