diff --git a/eng/common/pipelines/templates/steps/publish-artifact.yml b/eng/common/pipelines/templates/steps/publish-artifact.yml
index fc295f6801d9e..6e9bdd0f30bd4 100644
--- a/eng/common/pipelines/templates/steps/publish-artifact.yml
+++ b/eng/common/pipelines/templates/steps/publish-artifact.yml
@@ -20,7 +20,7 @@ steps:
       path: '${{ parameters.ArtifactPath }}'
 
   - task: PublishPipelineArtifact@1
-    condition: failed()
+    condition: and(failed(), ${{ parameters.CustomCondition }})
     displayName: 'Publish failed ${{ parameters.ArtifactName }} Artifacts'
     inputs:
       artifactName: '${{ parameters.ArtifactName }}-FailedAttempt$(System.JobAttempt)'