cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

azure automation "get job output" failed unsupportedmediatype

I am getting an error on a flow, that works work elsewhere.

 

I have a flow that calls an Azure Automation script, that script runs successfully and generates output.

 

The next step in the flow, tries to "get the job output"  but it fails with error "UnSupportedMediaType".

{
  "error": {
    "code""UnsupportedMediaType",
    "message""The content media type 'text/plain' is not supported. Only 'application/json' is supported."
  }
}

 

This works fine in other flows.  I have already "deleted" the activity, and re-created it.  That does not seem to help.

 

This is the code for the output from the automation script.

 

$Properties = [Ordered]@{
        "UserDisplayName"= "$($userobj.displayname)";
        "UserPrincipalName"= "$($userobj.userprincipalname)";
        "Date" = "$(Get-Date -Format MM-dd-yyyyThh:mm:ss)";
        "Previous EmplID" = "$($OldEmplID)";
        "New EmployeeID" = "$($EmployeeID)";
        "EmployeeID updated" = "$($EmplIDUpdated)";
        "CRMLicenseConfirmed" = "$($LicenseResults)";
        "LicenseType" = "$LicenseType";
        "Instance" = "$($Instance)";
        "InstanceAccessConfirmed" = "$($InstanceAccess)";
        "EmailApproved"= "$($CRMuser.isemailaddressapprovedbyo365admin)";
        "Selected Role" = "$($RoleName)";
        "RoleConfirmed" = "$($RoleConfirmed)";
        "FieldSecurityProfile" = "$($FSP)";
        "APiCallsToEnable" = "$($i)";
        "Roles" = "$($SecurityRoles -join ',')"
        }
$Report = new-object -TypeName psobject -Property $Properties
Write-Verbose "Outputing Report Object"
Return $Report

 

For the Flows that work, The only real difference I can determine is that these are 2 different scripts, but both scripts are in the same Azure Automation Account.   I basically copied the 1st script that works and is used everyday for production support, and removed its ability to connect to production. So 2nd script does the exact same thing, only it cannot connect to prod.

4 REPLIES 4
v-yuazh-msft
Community Support
Community Support

Hi @Anonymous,

 

Could you please share a screenshot of the configuration of your flow?

 

The error message told that the content media type 'text/plain' is not supported. Only 'application/json' is supported.

 

I afraid that there is something different between your scripts and there is something couldn't be supported in the one which run failed.

 

Best regards,

Alice

Hey, @Anonymous!

 

It appears as though @v-yuazh-msft would like some more information in order to further assist you properly with your issue. Please share any additional information that was requested in order to decrease the amount of time that it will take for you to be assisted!

 

Thank you for being an active member of the Flow Community!

-Gabriel
Flow Community Manager

- Gabriel
Community Manager
Power Automate | Power Virtual Agents
Super User Program Manager



Anonymous
Not applicable

What is it you want to see?  Its a fairly large flow.  

 

This one works

 

flowsteps2.PNG

 


This one does not work
flowsteps.PNG

 

 

 

 

** DELETE Uneeded code*** 
 
 
The flows themselves are identical with the exception of parameters. The output portion is identical.  And in the test window on Azure automation, the output comes out the same. The only reason for seperation is that 1 flow allows to be run against production, and the other (that does not work) will only work for non-production. (this is done in the automation script, prod is not allowed in the later)
 
 

 

Anonymous
Not applicable

I also just went in and deleted and recreated the action to get job output.  

 

And it now works!  

 

Seems like the "action" corrupted to some extent.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (1,514)