'azurepipelines template task condition not evaluating as expected

When I remove the task condition from the deploy_data_factory_steps.yaml template the parameter displays with the expected value:

parameter is DEV2

But when I run with the condition it fails to evaluate as True:

Evaluating: and(succeeded(), eq('$(env)', 'DEV2'))
Expanded: and(True, eq('$(env)', 'DEV2'))
Result: False

azurepipelines.yaml:

- stage: DataFactoryDEV2
  condition: and(succeeded(), eq('${{ parameters.runEnv }}', 'dev2'))
  dependsOn: DeployDEV2
  variables:
    - group: xxx_DEV2
  pool: 
    name: 'yyyDev'
  jobs: 
  - deployment: deploy
    environment: xxx-dev2
    strategy:
      runOnce:
        deploy:
          steps:
          - template: templates/deploy_data_factory_steps.yml
            parameters:
              environ: $(env)
              artifact: 'publish-factory'
              azureSubscription: 'yyy - xxx'

deploy_data_factory_steps.yaml

steps:
...

- task: AzureCLI@2
  condition: and(succeeded(), eq('${{ parameters.environ }}', 'DEV2'))
  displayName: 'Blah blah blah'
  inputs:
    azureSubscription: ${{ parameters.azureSubscription }}
    scriptLocation: inlineScript
    scriptType: bash
    inlineScript: |
      echo parameter is ${{ parameters.environ }}


Sources

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

Source: Stack Overflow

Solution Source