'Powershell Workflow with nested foreach

i'm writing a script to remove and recreate eventhub and private endpoint on Azure. I'm testing the loop before to proceed but had a problem with nested foreach inside a parallel foreach:

    workflow test-evh
{

$connectionResult = Connect-AzAccount -Identity
$connectionResult

    
$EvhExclusion = 'myevh'


    $EvhLists = Get-AzEventHubNamespace
    $PendsEvh = Get-AzPrivateEndpoint
    
    foreach -parallel -ThrottleLimit 10 ($EvhList in $EvhLists)
        {           
        if ($EvhList.Name -notin $EvhExclusion){    
           if ($EvhList.Location -eq "North Europe"){
                
            foreach ($PendEvh in $PendsEvh)
            {           

            if ($PendEvh.PrivateLinkServiceConnections.GroupIds -eq "namespace" -and $PendEvh.Location -eq "northeurope" -and $PendEvh.PrivateLinkServiceConnections.PrivateLinkServiceId -in $EvhList.Id ){

             Write-Output   $PendEvh.Name
            
            }

           
            }

            Write-Output $EvhList.Name

        }
    }
}

}

script work but i got only eventhub namespace. If i run it outside workflow and without parallel, it works and i got both private endpoint and namespace.

What i'm doing wrong?

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source