azurepowershellazure-logic-apps

Access Logic App Parameters in PowerShell script code in Standard workflows


I started learning how to do "PowerShell script code in Standard workflows". seams good solution.

I tried to access the logic app parameters with:

$Cert = (@{parameters('CertificatePFX')} )
$domain =( @{parameters('AADDomain-(Prod)')}  )

But I get error:

PowershellFunctionFailed
The inline code action 'Powershell' execution failed, with error 'At C:\home\site\wwwroot\wf-ReduceProposals\execute_powershell_code.ps1:8 char:22 + $Cert = (@{parameters('CertificatePFX')} ) + ~ Missing '=' operator after key in hash literal. At C:\home\site\wwwroot\wf-ReduceProposals\execute_powershell_code.ps1:9 char:24 + $domain =( @{parameters('AADDomain-(Prod)')} ) + ~ Missing '=' operator after key in hash literal.'.

I hope someone knows the correct syntax for that. Maybe I can only get environment variables with $env.{vname}?

How about PnP-Powershell? how do I incorporate it?

Thank you


Solution

  • Access Logic App Parameters in PowerShell script code in Standard workflows

    Parameters cannot be directly accessed inside the Inline PowerShell code, But they need to referenced with a variable or action output as below and I have followed Microsoft-Document and SO-Thread:

    Firstly, initialized empty variable and then set it to parameters('test')

    enter image description here

    In Execute Powershell Code :

    $rith = Get-ActionOutput -ActionName test
    $test = $rith.outputs
    $res = [string]$test.body.value
    Push-WorkflowOutput -Output $res
    

    enter image description here

    Output:

    enter image description here