Running Export-M365DSCConfiguration on Azure Automation Runbook does not export files
I am testing running Export-M365DSCConfiguration on Azure Automation Runbook. However, running Export-M365DSCConfiguration does not output any files.
`
$Date = $(Get-Date -f yyyy-MMM-dd-HHMMtt)
$applicationId = "
$tempPath = "$env:TEMP" $initialConfigurationFileName = "InitialM365TenantConfig.ps1" $adminUrl = "https://contoso-admin.sharepoint.com"
write-output "Pulling DSC from Tenant $Date" Export-M365DSCConfiguration -Workloads @("OD", "SPO") -Path $tempPath -ApplicationId $applicationId -TenantId $tenantId -CertificateThumbprint $certificateThumbprint -FileName $initialConfigurationFileName
Get-ChildItem $tempPath
`

I believe that InitialM365TenantConfig.ps1 should be created under "$env:TEMP", but it is not. Also, the InitialM365TenantConfig.ps1 file is successfully output when this script is run locally, not on Azure Automation. Therefore, I believe that running it on Azure Automation Runbook is related to the event. Does anyone have any ideas for a solution?
Did you use this guide to setup your runbook? https://o365eh.com/2020/10/27/episode-74-using-microsoft-dsc-as-a-runbook-in-azure-automation/
There were some issues related to this guide: https://github.com/microsoft/Microsoft365DSC/issues?q=runbook Please have a look at them as well.
Thanks for the response @andikrueger , Yes, I had this article confirmed. Just to be sure, I ran the M365DSCRunBookInstall part again and then ran Export-M365DSCConfiguration, but still nothing was output. Any other ideas?
Please have a look at this script: https://github.com/microsoft/Microsoft365DSC/issues/2050#issuecomment-1195414547 This could help to setup your environment properly.
@yoinuma did the link that Andi shared above help?
@andikrueger , @NikCharlebois Thanks for the advice. I have confirmed that we can successfully run Export-M365DSCConfiguration on Azure Automation by running the script https://github.com/microsoft/Microsoft365DSC/issues/2050#issuecomment-1195414547 that you taught me. The issue has been resolved and can be closed. Thanks again!