yamlazure-pipelines-yaml

yaml file - upper case parameter


I would like to make my paramter upper case

parameters:
  #Relative path to the BuildDirectory where artifacts are stored
  artifactLocation : ''
  env : ''
  serviceConnectionName: ''
  subscriptionId: ''
  #Arguments String to be used for the ADF deployment
  argumentsString: ''
  datafactoryName: ''
  resourceGroupName: ''
  location: ''

jobs:
- deployment: DeploymentJob
  displayName: 'Deploying Azure Data Factory'
  pool:
    name: $(agentPoolName)
  environment: "EMEA_${{ parameters.env.ToUpper() }}_MDP"  

I get this error:

Unexpected symbol: '('. Located at position 23 within expression: parameters.env.ToUpper()

what is the correct syntax?

I also have tried this way

parameters:
  # Relative path to the BuildDirectory where artifacts are stored
  artifactLocation: ''
  env: ''
  serviceConnectionName: ''
  subscriptionId: ''
  # Arguments String to be used for the ADF deployment
  argumentsString: ''
  datafactoryName: ''
  resourceGroupName: ''
  location: ''

variables:
  env_upper: ${{ upper(parameters.env) }}

jobs:
- deployment: DeploymentJob
  displayName: 'Deploying Azure Data Factory'
  pool:
    name: $(agentPoolName)
  environment: 'EMEA_${{ variables.env_upper }}_MDP'

error said that it did not exprext variables

And I aslo tried this way too:

environment: 'EMEA_${{ upper(parameters.env) }}_MDP'

this has not throwed error but it did not make upper case.


Solution

  • Instead of:

    ${{ parameters.env.ToUpper() }}
    

    Try:

    ${{ upper(parameters.env) }}
    

    See Expressions for a complete list of expressions and functions.