web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Return value/s from Az...
Power Automate
Answered

Return value/s from Azure Automation into Power Automate

(1) ShareShare
ReportReport
Posted on by 39
I have a very simple Power Automate flow (manually trigger flow > create job > get job output) that runs a very simple Azure Automation PowerShell runbook.
 
The runbook that is run in Azure Automation.
 
$FQDN = "ourdomain.com"

Import-Module -Name Microsoft.Entra

Connect-Entra -Identity -NoWelcome

$output = Get-EntraUser -Identity "some.user@$fqdn" | Select-Object -Property "displayName", "userPrincipalName"  | ConvertTo-Json -Compress
Write-Output $output
 
 
The runbook runs fine but Power Automate always show the following error message on the "Get job output" section.
The content media type 'text/plain' is not supported. Only 'application/json' is supported.
 
The error is pretty clear in that Power Automate can only ingest json but is getting text instead.
 
What do I need to do in my PowerShell script so that json is correctly being output?
I have the same question (0)
  • Ish S Profile Picture
    96 on at
    Instead of the "get job output",  you can try to have a subsequent action to "Parse JSON" to see what you get from that.
     
     
    If these suggestions help resolve your issue. Please consider marking the answer as such.
     
  • CU10120534-0 Profile Picture
    39 on at
    Just so I understand correctly you are saying remove the "Get job output" step and replace it with a "Parse JSON" step instead?
     
    If that is the case what should the Content be for the Pase JSON step?
  • ViktorIvanidze Profile Picture
    on at
    May I ask you why do you need to use this Azure Automation PowerShell runbook at all?
    There exists the Power Automate action "Search for users (V2)" of "Office 365 Users" connector.
  • CU10120534-0 Profile Picture
    39 on at
    It is because my script checks for duplicate UPN and email address so I want to ensure that I have the correct, newly created UPN/email address rather than grabbing any match on full name.
  • Suggested answer
    ViktorIvanidze Profile Picture
    on at
     
    use this request to retrieve a user based on any email address (assuming the sender address is like "jdoe@contoso.com") : 
     
  • Verified answer
    CU10120534-0 Profile Picture
    39 on at
    The problem is I do not know the user's email address before it is created as it maybe jsmith or jsmith1 etc.

    I have "solved" this by doing a workaround.

    What I have done is broken my flow into two parts, one part that creates the user account and then another part that updates a SharePoint list and emails/teams messages out information about the new user account.

    What I do with the user creation flow that feeds into Auzure Automation is pass along the required account creation information that is used directly by Azure Automation along with some additional details which gets passed back via a webhook into my second flow that creates a SharePoint item and emails/teams messages various staff.

    It maybe a little tidier rather than passing along all the information into Azure Automation and not using it at all to instead create the new SharePoint item in the first flow and then pass along only the SharePoint item's ID into Azure Automation which would then be passed into the second flow using webhooks to just updated the newly created SharePoint list item with the additional user accounts details that were generated during the account creation process.

    I still think there is something broken with the "Get job output" function in Power Automate but I have no idea how to raise a bug report with Microsoft so it will just have to remain like that.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 605

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard