Azure Pipelines YAML hidden UI for parameters as input

The Azure Pipelines is the feature of Azure DevOps that allows you to automate your build and release processes, to unleash the full potential of CI/CD practices.

Pipelines can be simple or complicated but, it’s very likely that you need to specify some kind of input to a Pipeline just before starting it.

Classic Pipelines

This is where variables come to help when you’re using the classic version of Azure Pipelines. Inside the Variable tab you write variables and then you can set if it’s “settable at queue time”. This way, when you start the pipeline, a slice of UI will provide a prompt to complete. The input is treated as a string and you can’t do much more.

Option to set a variable at queue time.

YAML Pipelines – This is where magic happens!

If you’re trying to achieve the same thing with YAML pipelines you can rely on the power of parameters. Actually, you can achieve more with YAML pipelines!

Runtime parameters let you have more control over what values can be passed to a pipeline. With runtime parameters you can:
– Supply different values to scripts and tasks at runtime
– Control parameter types, ranges allowed, and defaults
– Dynamically select jobs and stages with template expressions

https://docs.microsoft.com/en-us/azure/devops/pipelines/process/runtime-parameters

Because parameters are explicitly typed you can create a better user experience for users of your pipelines with a fully featured UI with check-boxes, radio-buttons and text areas. You can do this in 3 easy steps. Open your YAML definition and for each one of the inputs that you need:

  1. Create a parameter
  2. Specify a default value
  3. Specify allowed values

This an example of a YAML Pipeline definition that accepts a string as an input to complete the famous “Hello World” greeting but, within a set of specific allowed values. Also, the default value is set to world.

parameters:
  - name: myString
    displayName: string
    type: string
    default: 'world'
    values:
    - world
    - mondo

pool:
  vmImage: 'ubuntu-latest'

steps:
- script: echo Hello, ${{ parameters.myString }}!
  displayName: 'Run a one-line script'

When you Run the pipeline the UI shows specific fields to collect your input (greetings in our example).

The Run Pipeline dialog with additional parameters.

I suggest you to try with all the parameters type that the YAML schema provides. This is a complete example showing all the available options:

parameters:
  - name: myParameter
    displayName: greetings
    type: string
    default: 'world'
    values:
    - world
    - mondo
  - name: myNumber
    displayName: 'Number'
    type: number
    default: '1'
    values:
    - 1
    - 2
    - 3
  - name: myBoolean
    type: boolean
    default: true
  - name: myObject
    type: object
    default:
      foo: FOO
      bar: BAR
      things:
      - one
      - two
      - three
      nested:
        one: apple
        two: pear
        count: 3
  - name: myStep
    type: step
    default:
      script: echo my step
  - name: mySteplist
    type: stepList
    default:
      - script: echo step one
      - script: echo step two

pool:
  vmImage: 'ubuntu-latest'

steps:
- script: echo Hello, ${{ parameters.myParameter }}!
  displayName: 'Run a one-line script'


The resulting UI is:

Isn’t this awesome?

The power of the community

Thanks to my friend Giulio Vian of getlatestversion.it for the heads-up about this feature. The official Microsoft doc lacks a detailed explanation of this specific usage of YAML Pipelines parameters!

My developer/it pro toolkit for Windows (2021)

Every IT professional / programmer / developer has a toolkit to do be more productive. It’s the based on years of experience, tips from colleagues, friends, and experts.
This is my list of tools that I use more often. I don’t use every tool every day.

This is my first list and it will be interesting to see how this will evolve year over year.

Misc

Windows Terminal / If you are a terminal user this is for you. It’s a modern implementation of a terminal for Windows. Its main features include multiple tabs, panes, Unicode and UTF-8 character support, a GPU accelerated text rendering engine, and the ability to create your own themes and customize text, colors, backgrounds, and shortcuts.
Chocolatey / The Package Manager for Windows. Forget browsing to the website of your favorite tool, click download, open the setup, next-next-next-finish. Just write choco install mytool -y and you’re done!
Windows Subsystem for Linux / A complete GNU/Linux environment inside Windows. I use this to learn or explore Linux commands. It’s fast and without the overhead of a traditional virtual machine.
Notepad2 / A replacement for the standard notepad.exe. Syntax highlight support, super light and fast!
Visual Studio Code / Free. Built on open source. Runs everywhere. Free. Built on open source. Runs everywhere. A swiss-army knife for any code related activity.
Nightingale / A native Windows application REST client. An alternative to Postman. A lovely UI and smooth user experience.
PowerToys / A collection of tools to improve your Windows experience.
ZoomIt / It’s perfect to zoom on the screen and draw arrows, lines, and rectangles while doing screen sharing sessions.
Fork / a great UI for git.
Total Commander / A replacement of Windows File Explorer. Good old, feature rich and you can use it with just keyboard shortcuts. Blazing fast to rename, move or copy batch of files.
Markdown Monster / An IDE for your markdown files!
Fiddler / THE web debugger.
BeyondCompare / Compare directories, files, exe… If you have to compare something this is the tool you’re looking for.
SnagIt / screen capture on steroids
Procmon / Do you want to know every single detail of what happens in your registry, file system, and processes/thread activities? This is the tool that you’ll open to diagnose issues or behaviors happening on Windows.

Visual Studio Code Extensions

GitLens / Git superpowers in your VS Code.
Docker for VS Code / You can get IntelliSense when editing your Dockerfile and docker-compose.yml files, with completions and syntax help for common commands.
PowerShell / Bye bye PowerShell ISE.
RESTClient / Send HTTP request directly and view the response directly from VS Code. It can also generate code snippets to make HTTP call in the most common languages.