Collecting subscription from the stages in release instead of using the pipeline variable.

Deepak Kumar Sharma 60 Reputation points
2024-02-14T11:22:33.0033333+00:00

Dear Team, I am currently engaged in the development of a YAML pipeline to validate a PowerShell script that performs specific tasks. The PowerShell script incorporates a variable, $subscriptionId, where the value needs to be provided within the build and release pipeline. However, I aim to avoid utilizing a pipeline variable for the subscriptionId. Is there a method to gather the subscriptionId from the release pipeline to the YAML task that I am executing? Below is the inline script used for validating the build pipeline:

powershellCopy codeInstall-Module -Name PSScriptAnalyzer -Force -Scope CurrentUser

I seek your guidance on whether it is feasible to collect the subscription ID from the PowerShell task. Thank you for your assistance.

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. dashanan13 930 Reputation points
    2024-02-15T23:34:23.08+00:00

    Hei @Deepak Kumar Sharma ,

    Thank you for contacting Microsoft Community. As i understand, you have a pipeline with a powershell task and you want to pass the output of the powershell task to the next task. Essentially save the output of powershell task to a runtime variable and then reference the runtime variable in the next task.

    If this solves your issue, do mark this as an answer

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.