Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

in YAML how to passing multiple arguments to powershell script

- task: PowerShell@2
          inputs:
            targetType: 'filepath'
            filePath: $(System.DefaultWorkingDirectory)/psscript.ps1
            arguments: >
              -ContainerName $(ContainerName
              **-Url $(Url) + '&sub-key=' + $(SubscriptionKey)**
          displayName: 'Uploading files'

-URL is not working
error | You must provide a value expression following the '+' operator.

like image 506
kumar8891 Avatar asked Oct 18 '25 08:10

kumar8891


1 Answers

Please try this:

jobs:
- job:
  variables:
    a: $[format('{0}"&"sub-key={1}', variables.Url, variables.SubscriptionKey)]
  steps:
    - task: PowerShell@2
      inputs:
        targetType: 'filepath'
        filePath: $(System.DefaultWorkingDirectory)/psscript.ps1
        arguments: >
            -ContainerName $(ContainerName)
            -Url $(a)
      displayName: 'Uploading files'

like image 116
Krzysztof Madej Avatar answered Oct 21 '25 03:10

Krzysztof Madej