I have a logic app that is passing input parameters to a PowerShell Azure Automation job the job keeps failing. The input parameters are in this format:
The PowerShell script I have is as follows:
param (
[Parameter(Mandatory=$true)]
[string]$azureArcJson,
[Parameter(Mandatory=$true)]
[string]$crowdstrikeJson
)
try {
Print the received JSON strings for debugging
Write-Output "Received Azure Arc JSON string: $azureArcJson"
Write-Output "Received Crowdstrike JSON string: $crowdstrikeJson"
#Parse the input JSON strings
$azureArcEntities = $azureArcJson | ConvertFrom-Json
$crowdstrikeEntities = $crowdstrikeJson | ConvertFrom-Json
#Extract hostnames
$azureArcHostnames = $azureArcEntities | ForEach-Object { $_.Hostname }
$crowdstrikeHostnames = $crowdstrikeEntities | ForEach-Object { $_.Hostname }
Find missing hostnames
$azureArcMissing = $crowdstrikeHostnames | Where-Object { $_ -notin $azureArcHostnames }
$crowdstrikeMissing = $azureArcHostnames | Where-Object { $_ -notin $crowdstrikeHostnames }
#Format the output for discrepancies
$output = "Discrepancies between Azure Arc and Crowdstrike Hostnames:`n"
$output += "Hostnames in Crowdstrike but not in Azure Arc:`n"
$output += ($azureArcMissing -join "`n")
$output += "`n`nHostnames in Azure Arc but not in Crowdstrike:`n"
$output += ($crowdstrikeMissing -join "`n")
Write-Output $output
}
catch {
Write-Error "An error occurred: $_"
}
The job continues to fail with the following Exception: Cannot process argument transformation on parameter 'azureArcJson'. Cannot convert value to type System.String. (Cannot convert value to type System.String. (Cannot convert value to type System.String.))
I am unsure what to do to get this script to work. Can anyone help me?


objectand then write some debug output containing the value type (write-host $azureArcJson.GetType().FullName) and it’s json representation (write-host ($azureArcJson | convert to-json -Deprh 2)) which won’t solve the problem but will give you a bit more information about what is being passed in, and that might help…azureArcJsoncontains. Can you share it here. @SentinelAzure