Passing Custom Objects between Azure runbooks -


i need call runbook runbook , custom object output in azure automation . works fine if called runbook returns int or string returning custom objects not done.a simple example called runbook

     workflow calledrunbook       {         [outputtype([object])]         $obj1=@{"key1"="value1"}         $obj1      }  

now runbook called callingrunbook , need print obj1

   workflow callingrunbook     {       #after doing proper authentication        $job = start-azureautomationrunbook -name "calledrunbook" -automationaccountname $automationaccountname         $doloop = $true       while($doloop) {             start-sleep -s 5              $job = get-azureautomationjob -id $job.id -automationaccountname $automationaccountname              $doloop = (($job.status -notmatch "completed") -and ($job.status -notmatch "failed") -and ($job.status -notmatch "suspended")  -and ($job.status -notmatch "stopped"))         }          $jobout = get-azureautomationjoboutput `                                 -id $job.id `                                 -automationaccountname $automationaccountname `                                 -stream output         if ($jobout) {               write-output $jobout         }     } 

the output empty. if return string works fine. how make work custom objects ?

each output record of runbook job in azure automation stored string, regardless of type. if object being outputted not string, serialized string. appear object not serialize string correctly, azure automation not storing string version job output.

to workaround this, recommendation serialize / deserialize object between 2 runbooks. use convertto-json on object in calledrunbook, , output result of that. output object json string. then, in callingrunbook, call convertfrom-json on output of calledrunbook, original object back.


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -