cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

JSON Parse Fail with Azure Automation output

Hi All,

 

I've an Azure Automation script that's will be executed from my flow. With the script I create new Microsoft Teams.

As last point in my script I convert the Groupt-ID to JSON. (write-output $newteam | select GroupID | convertto-Json)

 

Because the Azure Automation runbook script has two outputs. (See image).

Output script.png

 

The first output is a default output, about my account and tenant information. I don't know how to skip this info as output. The second output is the expected output (the GroupId).

 

My Flow is failing because I receive both outputs.

Flow Output.png

This is failing my JSON Parse part in my flow. See second picture.

 

Did any one know what I need to do to skip the account/tenant output and only use the GroupID output?

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: JSON Parse Fail with Azure Automation output

Hi @dennisb88 

 

It's a bit tricky because the output is not a JSON format. So try the below expression.

 

trim(replace(replace(replace(last(split(outputs('Compose_3'), 'GroupdId')), ':', ''), '}', ''), '"', ''))
 
Note: Above outputs('Compose_3') is where I input the test data.
 
image.png
 
 
Thanks


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

View solution in original post

6 REPLIES 6
Highlighted
Super User III
Super User III

Re: JSON Parse Fail with Azure Automation output

Hi @dennisb88 

 

Before it hits the JSON Parser could you check the JSON data string value contains using an IF condition to make sure it's the right data structure you are passing to next step. Another way you could do is use flow exception handler under JSON Parser > Configure run after 

 

image.png 

 

 

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Highlighted
Regular Visitor

Re: JSON Parse Fail with Azure Automation output

Hi @abm ,

 

Thank you for your reply.

 

I didn't realy understand what you mean with "Before it hits the JSON Parser could you check the JSON data string value contains using an IF condition to make sure it's the right data structure you are passing to next step.(Sorry I'm not have JSON skills)

 

But I think the complete issue is that my Automation Runbook send more output back to my flow than required.

Maybe are the follow printscreens helping to understand the issue:

Task output.png

 

I need only the groupId from the runbook output. But I get also the Run details from the runbook.

This is since two months. Before half november, it was working fine without the information about the Environment.

 

The setting "failed" doesn't help.

Highlighted
Super User III
Super User III

Re: JSON Parse Fail with Azure Automation output

Hi @dennisb88 

 

Because you mentioned the first & second output results I thought you must be getting two different set of JSON results one after the other. Looks like from the screen shot the output is below format:

 

Account : "ddd"
Environment : "ddd"
Tenant : "T"
TenantId : "TId"
TenantDomain :
{
"GroupdId": "123"
}

 

This is not a JSON record format anymore. Is that correct?

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Highlighted
Regular Visitor

Re: JSON Parse Fail with Azure Automation output

Hi @abm ,

 

That's correct.

Reactie.png

I know that the first part is not JSON. But that's the default output that I get as result after I run the Azure Automation Runbook. The runbook gives two output "objects" where only the second one is the right one:

Script.png

I didn't know how I can skip that part of the output and get only the JSON output from Azure Automation.

 

Regards.

Highlighted
Super User III
Super User III

Re: JSON Parse Fail with Azure Automation output

Hi @dennisb88 

 

It's a bit tricky because the output is not a JSON format. So try the below expression.

 

trim(replace(replace(replace(last(split(outputs('Compose_3'), 'GroupdId')), ':', ''), '}', ''), '"', ''))
 
Note: Above outputs('Compose_3') is where I input the test data.
 
image.png
 
 
Thanks


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

View solution in original post

Highlighted
Regular Visitor

Re: JSON Parse Fail with Azure Automation output

Hi @abm ,

 

Thank you! That was the trick!

 

I'm a happy guy at this moment!

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Users online (4,438)