I'm trying to set up a Power Automate flow to create user accounts through an Azure Automation PowerShell runbook. Specifically, I want to return some values, like the UPN or email address, from the runbook back into the flow so I can use them to update a SharePoint list. In my test flow, I have the sequence set to 'Create Job', followed by 'Get Job Output', but I'm hitting an error: 'The content media type "text/plain" is not supported. Only "application/json" is supported.' My PowerShell script is simple; it retrieves the user info with `Get-EntraUser -Identity "some.user@$fqdn" | ConvertTo-Json`. It's working fine in Azure Automation but isn't passing back to Power Automate correctly. How can I adjust my PowerShell code to ensure the UPN/email address is sent back to the flow?
1 Answer
Make sure that in your flow, the HTTP action (if you’re using it) has the `Content-Type` header set to `application/json`. It seems like the error could stem from that. If you aren't using any HTTP action, double-check how you're setting those headers in your flow. You might need to explicitly define the output type somewhere in your Power Automate setup to avoid receiving plain text.

I don’t have an HTTP action; my flow just goes from manually triggering to creating the job and then getting the job output.