[{"data":1,"prerenderedAt":144},["ShallowReactive",2],{"/2025/12/10-azure-devops-output-variable":3},{"id":4,"title":5,"body":6,"date":135,"description":38,"extension":136,"meta":137,"navigation":138,"path":139,"robots":140,"seo":141,"stem":142,"__hash__":143},"posts/2025/12/10 azure-devops-output-variable.md","10 Azure Devops Output Variable",{"type":7,"value":8,"toc":132},"minimark",[9,18,21,25,39,41,56,64,66,69,77,79,90,92,106,108,119,127,129],[10,11,13],"post-title",{":date":12},"date",[14,15,17],"h1",{"id":16},"azure-devops-output-variable","Azure DevOps Output Variable",[19,20],"br",{},[22,23,24],"p",{},"It is supposed to be a simple task. I need the image uri that was pushed by ECRPushImage task in Azure DevOps on the next task. ECRPushImage task has outputVariable variable, so let say I set that to ImageUri on my azure-pipelines.yml",[26,27,28],"code-block",{},[29,30,35],"pre",{"className":31,"code":33,"language":34},[32],"language-text","- task: ECRPushImage@1\n  inputs:\n    ...\n    outputVariable: 'ImageUri'\n","text",[36,37,33],"code",{"__ignoreMap":38},"",[19,40],{},[22,42,43,44,55],{},"According to this article ",[45,46,49],"span",{"className":47},[48],"text-blue-600",[50,51,52],"a",{"href":52,"rel":53},"https://learn.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch#use-output-variables-from-tasks",[54],"nofollow",", I also need to set name on the task:",[26,57,58],{},[29,59,62],{"className":60,"code":61,"language":34},[32],"- task: ECRPushImage@1\n  name: ECR\n  inputs:\n    ...\n    outputVariable: 'ImageUri'\n",[36,63,61],{"__ignoreMap":38},[19,65],{},[22,67,68],{},"So, I can use the variable like following:",[26,70,71],{},[29,72,75],{"className":73,"code":74,"language":34},[32],"- script: echo $(ECR.ImageUri) \n",[36,76,74],{"__ignoreMap":38},[19,78],{},[22,80,81,82,89],{},"But it doesn't work, the variable was not replaced. I also tried other runtime syntax in ",[45,83,85],{"className":84},[48],[50,86,87],{"href":87,"rel":88},"https://learn.microsoft.com/en-us/azure/devops/pipelines/process/variables?view=azure-devops&tabs=yaml%2Cbatch#understand-variable-syntax",[54],".",[19,91],{},[22,93,94,95,102,103,89],{},"So, I went to the GitHub ",[45,96,98],{"className":97},[48],[50,99,100],{"href":100,"rel":101},"https://github.com/aws/aws-toolkit-azure-devops/blob/master/src/tasks/ECRPushImage/TaskOperations.ts#L81",[54]," and it does a simple ",[36,104,105],{},"task.setVariable()",[19,107],{},[22,109,110,111,118],{},"According to the setVariable documentation ",[45,112,114],{"className":113},[48],[50,115,116],{"href":116,"rel":117},"https://learn.microsoft.com/en-us/azure/devops/pipelines/process/set-variables-scripts?view=azure-devops&tabs=bash#about-tasksetvariable",[54],", we can access the variable without the name, so it becomes:",[26,120,121],{},[29,122,125],{"className":123,"code":124,"language":34},[32],"- task: ECRPushImage@1\n  inputs:\n    ...\n    outputVariable: 'ImageUri'\n- script: echo $(ImageUri)\n",[36,126,124],{"__ignoreMap":38},[19,128],{},[22,130,131],{},"And it works! That's after 10 iterations of trials and errors.",{"title":38,"searchDepth":133,"depth":133,"links":134},2,[],"2025-12-10T00:00:00.000Z","md",{},true,"/2025/12/10-azure-devops-output-variable",null,{"title":5,"description":38},"2025/12/10 azure-devops-output-variable","ugJdVeTkAEWEPHPvyTfIEqvo1Tpmsv1U141mtUwIEXU",1785167452239]