1. Нам важно Ваше мнение!
    и обсуждайте вместе! Нажимайте "мне нравится" и рекомендуйте друзьям ;)
    Понравилось тема? Напишите в ней свой отзыв.
    Считаете что тема не достаточно полно раскрыта? Расскажите свою точку зрения!
    С Вашей помощью сделаем форум еще лучше!

Kansas City : gartner devops - Эдуард Кабринский

Тема в разделе 'Горячие новости для тех кто следит за собой', создана пользователем IZRAELEn, 19 май 2021.

  1. IZRAELEn

    IZRAELEn Member

    Eduard Kabrinskiy - Azure devops output variables - Кабринский Рдуард


    <h1>Azure devops output variables</h1>
    <p>[youtube]</p>
    Azure devops output variables <a href="http://remmont.com">News page</a> Azure devops output variables
    <h1>Saving runtime variables to Azure DevOps Variable Groups</h1>
    <p>We use ARM outputs quite extensively in our Azure DevOps pipelines. At times you may need to get outputs from previous steps and store them as variables to be consumed further down the pipeline. The following blog post already details this process really well blog post.</p>
    <p style="clear: both">However, once the pipeline is finished these variables are lost and therefore if you need to refer them at a later stage you will need to find the deployment task in Azure (if it still exists) and manually get the outputs again. Here you can see the outputs in the Azure Portal: <img style="float: left; margin: 0 10px 5px 0;" src="https://github.com/starkfell/100DaysOfIaC/blob/master/images/day67/Outputs.png" /></p>
    <p>The solution to this, is to save these variables to a variable group in Azure DevOps which can then be referred to in other pipelines. This article will show you how to use Azure CLI to create a new variable group in Azure DevOps and save your runtime variables to it.</p>
    <h2>Requirements</h2>
    <p>First you need to assign the</p>
    <p>'s Build Service ( ) Create permission to the Variable Groups.</p>
    <p style="clear: both"><img src="https://mscloud.be/assets/images/2020-04-17-AssignAccessToVariableGroups.png" /></p>
    <h2>Update Pipeline</h2>
    <p>Next, we will add a couple of tasks to login to Azure DevOps CLI from within the pipeline using the $(System.AccessToken) . More on this can be found here.</p>
    <p>After this, we will add a PowerShell Task to our pipeline to create the Variable Group and populate the first variable.</p>
    <blockquote><p>Note: Although in Microsoft?s documentation it mentions to use echo $ <AZURE_DEVOPS_CLI_PAT>| az devops login to login, I was getting error message when creating the Variable Group. Therefore I use echo $(System.AccessToken) | az devops login instead.</p></blockquote>
    <h2>Modify output script</h2>
    <p>In our pipeline to retrieve outputs from ARM templates we use a PowerShell tasks to capture the JSON outputs and use the captured output in following steps. You can find more information regarding the output script here.</p>
    <blockquote><p>Note: I had already previously made other modifications to the script to handle Object type variables and read 1 level further into those Objects.</p></blockquote>
    <p>We will modify the output.ps1 script to add an extra parameter called VariableGroupID. This is the VariableGroupID variable that we captured when we created the variable group in the PowerShell task in the previous step. If this parameter is passed it will record whatever variable it is creating as a new entry into the variable group with the variable group id.</p>
    <h2>Running the pipeline</h2>
    <p style="clear: both">Now we kick off our pipeline and have a look at the results. <img style="float: left; margin: 0 10px 5px 0;" src="https://mscloud.be/assets/images/2020-04-17-PipelineExecution.PNG" /></p>
    <p style="clear: both">We can see that after the pipeline completes the following variable group is automatically created <img style="float: left; margin: 0 10px 5px 0;" src="https://mscloud.be/assets/images/2020-04-17-VariableGroupCreated.png" /></p>
    <p style="clear: both">And all ARM outputs from the pipeline are stored inside that variable group to be referenced at a later stage by different pipelines, stages or jobs for example. <img style="float: left; margin: 0 10px 5px 0;" src="https://mscloud.be/assets/images/2020-04-17-VariableGroupContent.png" /></p>
    <h2>Azure devops output variables</h2>

    <h3>Azure devops output variables</h3>
    <p>[youtube]</p>
    Azure devops output variables <a href="http://remmont.com">Latest it news</a> Azure devops output variables
    <h4>Azure devops output variables</h4>
    We use ARM outputs quite extensively in our Azure DevOps pipelines. At times you may need to get outputs from previous steps and store them as variables to be consumed further down the pipeline. The following blog post already details this process really well blog post.
    <h5>Azure devops output variables</h5>
    Azure devops output variables <a href="http://remmont.com">Azure devops output variables</a> Azure devops output variables
    SOURCE: <h6>Azure devops output variables</h6> <a href="https://dev-ops.engineer/">Azure devops output variables</a> Azure devops output variables
    #tags#[replace: -,-Azure devops output variables] Azure devops output variables#tags#

    Эдуард Кабринский
    news headlines

Поделиться этой страницей