'Run template conditionally on azure pipeline yaml

I have two different yml pipelines. I always trigger pipeline & send variable values via postman body. Here is the body portion.

{ 
        "definition": {
            "id": 151
        },
        "parameters": "{\"Plan\":\"sand\"}"
}

Now i want to run a template with the condition that if the Plan is sand, then template will run. I have used many conditions but nothing is working. Providing some conditions that i tried,

- ${{ if eq(variables.Plan, 'sand') }}:
  - template: Sandbox Tasks/sand.yml@templates

- ${{ if eq(parameters.Plan, 'sand') }}:
  - template: Sandbox Tasks/sand.yml@templates

- template: Sandbox Tasks/sand.yml@templates
  condition: eq(variables['Plan'], 'sand')

- template: Sandbox Tasks/sand.yml@templates
  condition: eq(parameters['Plan'], 'sand')

- ${{ if eq(variables['Plan'], 'sand') }}:
  - template: Sandbox Tasks/sand.yml@templates

- ${{ if eq(parameters['Plan'], 'sand') }}:
  - template: Sandbox Tasks/sand.yml@templates

What would be the proper way to run a template with conditions by matching a variables value?



Sources

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

Source: Stack Overflow

Solution Source