Hello,
I am pretty new at rundeck. I decided to move all the scripts to rundeck , and rundeck would connect to the server via winRM and execute them in-line. The target server is windows 2012.
This works fine for all dozen or so scripts except for one of my python scripts. The difference is that it calls subprocess.Popen, subprocess.communicate() to execute a powershell script hosted in the target node and read output. The powershell script connects to MS-Online and reads tenant account information. (mop.ps1)
When running the same code locally on the server I get a valid output:
DEBUG:__main__:This is r "SkuPartNumber","ActiveUnits","ConsumedUnits"
"VISIOCLIENT","3","3"
"POWER_BI_PRO","13","13"
"ENTERPRISEPACK","0","0"
"EXCHANGESTANDARD","4","4"
"O365_BUSINESS_PREMIUM","134","129"
"POWER_BI_STANDARD","1000000","10"
"OFFICESUBSCRIPTION","0","0"
"AAD_PREMIUM","1","0"
"EXCHANGEARCHIVE_ADDON","1","1"
, error is e
DEBUG:__main__:Got ['"AAD_PREMIUM"', '"1"', '"0"'] from MOP
But running it via rundeck, if I print stderr I see :
Get-MsolPartnerContract : You must call the Connect-MsolService cmdlet before calling any other cmdlets.
Please refer to screenshots.
I checked the ps file and the Import-Module cmd works just fine, the ps file runs fine when executed outside of python as well. It has worked for months without touching the code.
Rundeck executes the scripts on this node in the same execution directory where prior to rundeck the scripts used to work from. What am I doing wrong?
Appreciate some assistance.