Azure data factory stop all trigger azure cli for each loop

Pankaj Joshi 286 Reputation points
2023-02-22T16:21:13.6966667+00:00

I am using this CLI command though devops azure cli task to stop all azure data factory trigger but I am receiving error of "(". bracket. Could you please review and let me know where could be the possible syntax error?

$names = az datafactory trigger list --factory-name "xxx" --resource-group "xxx" --query "[?properties.runtimeState=='Started'].name" -o tsv --only-show-errors
foreach($name in $names){
    az datafactory trigger stop --factory-name "xxx" --resource-group "xxx" --name $name --only-show-errors
}
Azure DevTest Labs
Azure DevTest Labs
An Azure service that is used for provisioning development and test environments.
257 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,684 questions
Azure Policy
Azure Policy
An Azure service that is used to implement corporate governance and standards at scale for Azure resources.
802 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Pankaj Joshi 286 Reputation points
    2023-02-24T19:06:05.8666667+00:00

    Problem is resolved after selecting script type as "PowerShell" in azure cli task instead of "shell"

    1 person found this answer helpful.