From becae58fef2d509d99a2893f6c858058777c26a6 Mon Sep 17 00:00:00 2001 From: Frederik Gheysels Date: Mon, 19 Jul 2021 13:54:36 +0200 Subject: [PATCH 1/3] Improved usage documentation on Save-AzDevOpsBuild --- .../features/powershell/azure-devops.md | 36 +++++++++++++++---- 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/docs/preview/features/powershell/azure-devops.md b/docs/preview/features/powershell/azure-devops.md index b495ff30..83d67eac 100644 --- a/docs/preview/features/powershell/azure-devops.md +++ b/docs/preview/features/powershell/azure-devops.md @@ -6,11 +6,12 @@ layout: default # Azure DevOps This module provides the following capabilities: -- [Installation](#installation) -- [Setting a variable in an Azure DevOps pipeline](#setting-a-variable-in-an-azure-devops-pipeline) -- [Setting ARM outputs to Azure DevOps variable group](#setting-arm-outputs-to-azure-devops-variable-group) -- [Setting ARM outputs to Azure DevOps pipeline variables](#setting-arm-outputs-to-azure-devops-pipeline-variables) -- [Save Azure DevOps build](#save-azure-devops-build) +- [Azure DevOps](#azure-devops) + - [Installation](#installation) + - [Setting a variable in an Azure DevOps pipeline](#setting-a-variable-in-an-azure-devops-pipeline) + - [Setting ARM outputs to Azure DevOps variable group](#setting-arm-outputs-to-azure-devops-variable-group) + - [Setting ARM outputs to Azure DevOps pipeline variables](#setting-arm-outputs-to-azure-devops-pipeline-variables) + - [Save Azure DevOps build](#save-azure-devops-build) ## Installation @@ -122,4 +123,27 @@ Saves/retains a specific Azure DevOps pipeline run. PS> Save-AzDevOpsBuild -ProjectId $(System.TeamProjectId) -BuildId $(Build.BuildId) # The variables $(System.TeamProjectId) and $(Build.BuildId) are predefined Azure DevOps variables # Information on them can be found here: https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml -``` \ No newline at end of file +``` + +This function is intended to be used from an Azure DevOps pipeline. Internally, it uses some predefined Azure DevOps variables. +One of the environment variables that is used, is the the `SYSTEM_ACCESSTOKEN` variable. However, due to safety reasons this variable is not available out-of-the box. +To be able to use this variable, it must be explicitly added to the environment-variables. + +Example of how to use this function in an Azure DevOps pipeline: + +```yaml +- task: PowerShell@2 + displayName: 'Retain current build indefinitely' + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) + inputs: + targetType: 'inline' + pwsh: true + script: | + Install-Module -Name Arcus.Scripting.DevOps -Force + + $project = "$(System.TeamProjectId)" + $buildId = $(Build.BuildId) + + Save-AzDevOpsBuild -ProjectId $project -BuildId $buildId +``` From f5de97f907ab0bde5b77ec0bc8234823aa37d97f Mon Sep 17 00:00:00 2001 From: Frederik Gheysels Date: Mon, 19 Jul 2021 13:56:58 +0200 Subject: [PATCH 2/3] Fix: indentation was changed by editor --- docs/preview/features/powershell/azure-devops.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/preview/features/powershell/azure-devops.md b/docs/preview/features/powershell/azure-devops.md index 83d67eac..1d2aef4c 100644 --- a/docs/preview/features/powershell/azure-devops.md +++ b/docs/preview/features/powershell/azure-devops.md @@ -7,11 +7,11 @@ layout: default This module provides the following capabilities: - [Azure DevOps](#azure-devops) - - [Installation](#installation) - - [Setting a variable in an Azure DevOps pipeline](#setting-a-variable-in-an-azure-devops-pipeline) - - [Setting ARM outputs to Azure DevOps variable group](#setting-arm-outputs-to-azure-devops-variable-group) - - [Setting ARM outputs to Azure DevOps pipeline variables](#setting-arm-outputs-to-azure-devops-pipeline-variables) - - [Save Azure DevOps build](#save-azure-devops-build) +- [Installation](#installation) +- [Setting a variable in an Azure DevOps pipeline](#setting-a-variable-in-an-azure-devops-pipeline) +- [Setting ARM outputs to Azure DevOps variable group](#setting-arm-outputs-to-azure-devops-variable-group) +- [Setting ARM outputs to Azure DevOps pipeline variables](#setting-arm-outputs-to-azure-devops-pipeline-variables) +- [Save Azure DevOps build](#save-azure-devops-build) ## Installation From e004ac31b58c8a025083fe31e3a21b52f891fed9 Mon Sep 17 00:00:00 2001 From: Frederik Gheysels Date: Mon, 19 Jul 2021 13:57:52 +0200 Subject: [PATCH 3/3] fix: bullet was added by editor --- docs/preview/features/powershell/azure-devops.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/preview/features/powershell/azure-devops.md b/docs/preview/features/powershell/azure-devops.md index 1d2aef4c..cc04189a 100644 --- a/docs/preview/features/powershell/azure-devops.md +++ b/docs/preview/features/powershell/azure-devops.md @@ -6,7 +6,7 @@ layout: default # Azure DevOps This module provides the following capabilities: -- [Azure DevOps](#azure-devops) + - [Installation](#installation) - [Setting a variable in an Azure DevOps pipeline](#setting-a-variable-in-an-azure-devops-pipeline) - [Setting ARM outputs to Azure DevOps variable group](#setting-arm-outputs-to-azure-devops-variable-group)