parameters:
  - name: Variables
    type: object
    default: []
  - name: ContinueOnError
    type: boolean
    default: false

steps:
  - pwsh: |
      $rawVariables = @"
        ${{ convertToJson(parameters.Variables) }}
      "@
      $variables = ConvertFrom-Json $rawVariables -AsHashtable
      foreach ($key in $variables.Keys) {
        $value = $variables[$key]
        Write-Host "Setting: $key = $value"
        Write-Host "##vso[task.setvariable variable=$key]$value"
      }
    continueOnError: ${{ parameters.ContinueOnError }}
    displayName: Set DevOps Variables