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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Help passing data from...
Power Automate
Unanswered

Help passing data from azure automation to flow

(0) ShareShare
ReportReport
Posted on by

Hey, i have a powerapp that takes a text input field and passes it through to a flow.  The flow takes the text input string from the powerapp and creates an azure automation powershell job.  The flow waits while the automation job executes, then receives the runbook output.  This is where i am stuck.  The format of the runbook output is not json, so i can't use a parse json action and i don't know any other way of parsing the output to use further down the flow.

 

The runbook itself, is a simple powershell script that performs a get-azureaduser -objectid $upn.  The $upn is a runbook parameter, and provided by the user in the powerapp.  

 

This is the output of the content field from the "Get job output" flow action.  Its format is a combination of PSObject (maybe) and JSON..

 

Account : automation@domain.com
Environment : AzureCloud
Tenant : nnnn-nnnn-nnnn-nnnn-nnnn
TenantId : nnnn-nnnn-nnnn-nnnn-nnnn
TenantDomain : domain.onmicrosoft.com

{
 "UPN": "user1@domain.com",
 "Department": "Technology",
 "Title": "Information Technology",
 "Country": "Australia",
 "ImmutableId": "nnnnnn"
}

 

 Screen Shot 2019-07-10 at 21.37.19.png

 

Here is the runbook powershell code.

 

Param
(
 [Parameter (Mandatory= $true)]
 [string] $UPN = ""
)
import-module azuread
$creds = Get-AutomationPSCredential -Name 'creds'
connect-azuread -credential $creds
$u = get-azureaduser -objectid $UPN

$objOut = [PSCustomObject]@{
UPN = $u.UserPrincipalName
Department = $u.Department
Title = $u.JobTitle
Country = $u.Country
ImmutableId = $u.ImmutableId

}
Write-Output ( $objOut | ConvertTo-Json)

 

Here is the failure.

 

 

InvalidJSON. The 'content' property of actions of type 'ParseJson' must be valid JSON. The provided value '
 Account : automation@domain.com
Environment : AzureCloud
Tenant : nnnn-nnnn-nnnn-nnnn-nnnn
TenantId : nnnn-nnnn-nnnn-nnnn-nnnn
TenantDomain : domain.onmicrosoft.com

{
 "UPN": "user1@domain.com",
 "Department": "Technology",
 "Title": "Information Technology",
 "Country": "Australia",
 "ImmutableId": "nnnnnn"
}
 ' cannot be parsed: 'Unexpected character encountered while parsing value: A. Path '', line 0, position 0.'.

 

Categories:
I have the same question (0)
  • v-yamao-msft Profile Picture
    on at

    Hi @Anonymous ,

     

    When using the Parse Json action, you need to provide a valid JSON file.

     

    You may take the following docs for a reference:

    https://flow.microsoft.com/en-us/blog/five-services-json-http/

    https://prairiedeveloper.com/2018/12/parsing-json-in-microsoft-flow/

     

    Please try with item function to get the needed property:

    https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#item

     

    Best regards,

    Mabel          

     

  • kpmwin Profile Picture
    4 on at

    Replying to this old thread in the hopes that someone gets saved. In the example above, there are actually two outputs. One from the Connect-AzureAD command (that hasn't been formatted as JSON) and one from the Write-Output command (that has been formatted as JSON). It's the Connect-AzureAD command that caused the issue here. A quick fix would be to send it's output to the abyss.

     

    connect-azuread -credential $creds | Out-Null
  • Alexeis Profile Picture
    19 on at

    Hi

    I also use Out-Null, but I don't like it - becasue I have a large and complex Powershell Script and there may be warnings, and unwished outputs to stream.

    Is there any way just pass a particular variable, not the all output stream?

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 378 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 305 Super User 2025 Season 2

#3
Expiscornovus Profile Picture

Expiscornovus 155 Most Valuable Professional

Last 30 days Overall leaderboard