As far as I can tell by looking at other posts, using the subprocess library in Python is the most popular way to execute PowerShell commands from within Python. For example:
data = subprocess.check_output(["powershell.exe", "Connect-AzureAD -AccountId me@me.com \n Get-AzureADAuditSignInLogs"]).decode(sys.stdout.encoding)
However, I'm ultimately trying to add this script to an automation account in Azure. Specifying the executable "powershell.exe" in the script won't work in an Azure automation account runbook (raises a "FileNotFound" error).
Is there some other way you can get the sign in log data from within Python that would be more amenable to using in an Azure automation account runbook? Can the Azure library be used to get sign in log data instead?