Hi everyone I’m trying to use declarative pipeline that
- connects to private github repo (no error authenticating jenkins on github PAT: private access token)
- pipeline file has the instructions to jenkins
- there are 2 powershell script on repo:
- Connect-ToMgGraph.ps1: with parameters connects to Microsoft graph api
- script 1: has get-mguser ( graph API command to list users )
Jenkins setup:
Jenkins 2.470
on Azure VM Linux (ubuntu 24.04), Standard B2s (2 vcpus, 4 GiB memory)
running on Docker version 27.0.3, build 7d4bcd8
I can run the script to authenticate on Microsoft graph using parameters Connect-ToMgGraph.ps1
do I need to break into stages?
Then script2 that runs right after the “Connect-ToMgGraph.ps1” fails saying must authenticate
agent { label 'node1-windows11-surface' } stages { stage('hello') { steps { powershell """ powershell.exe -File \" Connect-ToMgGraph.ps1 \" -NoNewWindow -Wait -entraapp -AppId 'xxx' -Tenant 'letsintune.com' -AppSecret 'xxx' write-output "Waiting....." powershell.exe -File \"Script1.ps1\" -NoNewWindow -Wait """ } } } }
console output
Waiting…
Running Script 1
powershell.exe : get-mguser : Authentication needed. Please call Connect-MgGraph.