Cmdlet
Write-ConsoleAnnotation
Writes a CI error, warning or notice, or a styled terminal status line.
Syntax
Write-ConsoleAnnotation
[-Column <Int32>]
[-File <String>]
-Level <Error| Warning| Notice>
[-Line <Int32>]
-Message <String>
[-Title <String>]
[<CommonParameters>]#Parameter set:
All Parameter SetsDescription
GitHub Actions and Azure Pipelines receive native annotations with escaped literal text. Azure notices and GitLab annotations are ordinary lines. Other hosts show a status line with a source-file link where supported. This command does not change the process exit code or write to PowerShell's error stream.
Examples
Example 1
Write-ConsoleAnnotation -Level Error -Message 'Missing configuration' -File ./build.ps1 -Line 12 -Column 5Point to a build error
Example 2
$result = [pscustomobject]@{ Name = 'Inventory'; Detail = 'Two servers need an update' }
Write-ConsoleAnnotation -Level Warning -Title $result.Name -Message $result.DetailHighlight an inventory warning in a CI log
Parameters
- -Column Int32
- The one-based source column.
- -File String
- The optional source file; relative paths resolve from the current PowerShell location. Files inside the provider workspace use checkout-relative paths with forward slashes; outside paths stay as supplied. Terminal labels are relative to the current location and show the file and line once, linked where supported.
- -Level AnnotationLevel
- Error, Warning or Notice.
- Possible values:
Error,Warning,Notice - -Line Int32
- The one-based source line.
- -Message String
- The literal annotation text.
- -Title String
- An optional title; Azure and plain lines prepend it to the message.
Common Parameters
This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters.