Unlocking M365 Continuous Audit and Beyond by Running PowerShell from Python like a pro (Yes, it’s actually possible)
The integration of Microsoft 365 support into Prowler faced limitations with Microsoft Graph API, prompting a shift to running PowerShell from Python using subprocess. Key challenges included memory management, security against command injection, and maintaining authentication across commands. A hybrid architecture was developed, utilizing both Microsoft Graph and controlled PowerShell sessions to achieve comprehensive CIS coverage. This effort led to the creation of the open-source project py-pwsh-session, designed to facilitate secure PowerShell execution from Python.

































-p-130x130q80.png)





