You can run this command in a script to force the result of a pipeline task:
- script: echo "##vso[task.complete result=SucceededWithIssues;]"
Possible task results are:
See more here: https://learn.microsoft.com/en-us/azure/devops/pipelines/scripts/logging-commands?view=azure-devops&tabs=bash#example-1