steps.pwsh definition

The pwsh step runs a script in PowerShell Core on Windows, macOS, and Linux.

steps:
- pwsh: string # Required as first property. Inline PowerShell script.
  errorActionPreference: string # Unless otherwise specified, the error action preference defaults to the value stop. See the following section for more information.
  failOnStderr: string # Fail the task if output is sent to Stderr?
  ignoreLASTEXITCODE: string # Check the final exit code of the script to determine whether the step succeeded?
  workingDirectory: string # Start the script with this working directory.
  condition: string # Evaluate this condition expression to determine whether to run this task.
  continueOnError: boolean # Continue running even on failure?
  displayName: string # Human-readable name for the task.
  target: string | target # Environment in which to run this task.
  enabled: boolean # Run this task when the job runs?
  env: # Variables to map into the process's environment.
    string: string # Name/value pairs
  name: string # ID of the step.
  timeoutInMinutes: string # Time to wait for this task to complete before the server kills it.
  retryCountOnTaskFailure: string # Number of retries if the task fails.
steps:
- pwsh: string # Required as first property. Inline PowerShell script.
  errorActionPreference: string # Unless otherwise specified, the error action preference defaults to the value stop. See the following section for more information.
  failOnStderr: string # Fail the task if output is sent to Stderr?
  ignoreLASTEXITCODE: string # Check the final exit code of the script to determine whether the step succeeded?
  workingDirectory: string # Start the script with this working directory.
  condition: string # Evaluate this condition expression to determine whether to run this task.
  continueOnError: boolean # Continue running even on failure?
  displayName: string # Human-readable name for the task.
  target: string | target # Environment in which to run this task.
  enabled: boolean # Run this task when the job runs?
  env: # Variables to map into the process's environment.
    string: string # Name/value pairs
  name: string # ID of the step.
  timeoutInMinutes: string # Time to wait for this task to complete before the server kills it.
steps:
- pwsh: string # Required as first property. Inline PowerShell script.
  errorActionPreference: string # Unless otherwise specified, the error action preference defaults to the value stop. See the following section for more information.
  failOnStderr: string # Fail the task if output is sent to Stderr?
  ignoreLASTEXITCODE: string # Check the final exit code of the script to determine whether the step succeeded?
  workingDirectory: string # Start the script with this working directory.
  condition: string # Evaluate this condition expression to determine whether to run this task.
  continueOnError: boolean # Continue running even on failure?
  displayName: string # Human-readable name for the task.
  enabled: boolean # Run this task when the job runs?
  env: # Variables to map into the process's environment.
    string: string # Name/value pairs
  name: string # ID of the step.
  timeoutInMinutes: string # Time to wait for this task to complete before the server kills it.

Definitions that reference this definition: steps

Properties

pwsh string. Required as first property.
Inline PowerShell script.

errorActionPreference string.
Unless otherwise specified, the error action preference defaults to the value stop. See the following section for more information.

failOnStderr string.
Fail the task if output is sent to Stderr?

ignoreLASTEXITCODE string.
Check the final exit code of the script to determine whether the step succeeded?

workingDirectory string.
Start the script with this working directory.

condition string.
Evaluate this condition expression to determine whether to run this task.

continueOnError boolean.
Continue running even on failure?

displayName string.
Human-readable name for the task.

target target.
Environment in which to run this task.

enabled boolean.
Run this task when the job runs?

env string dictionary.
Variables to map into the process's environment.

name string.
ID of the step. Acceptable values: [-_A-Za-z0-9]*.

timeoutInMinutes string.
Time to wait for this task to complete before the server kills it.

Note

Pipelines may be configured with a job level timeout. If the job level timeout interval elapses before your step completes, the running job (including your step) is terminated, even if the step is configured with a longer timeoutInMinutes interval. For more information, see Timeouts.

retryCountOnTaskFailure string.
Number of retries if the task fails.

Remarks

The pwsh keyword is a shortcut for the PowerShell task when that task's pwsh value is set to true. The task runs a script in PowerShell Core on Windows, macOS, and Linux.

Learn more about conditions and timeouts.

Each PowerShell session lasts only for the duration of the job in which it runs. Tasks that depend on what has been bootstrapped must be in the same job as the bootstrap.

Examples

steps:
- pwsh: Write-Host Hello $($env:name)
  displayName: Say hello
  name: firstStep
  workingDirectory: $(build.sourcesDirectory)
  failOnStderr: true
  env:
    name: Microsoft

See also