Azure DevOps
This module provides the following capabilities:
#
InstallationTo have access to the following features, you have to import the module:
PS> Install-Module -Name Arcus.Scripting.DevOps -RequiredVersion 0.4.3
#
Setting a variable in an Azure DevOps pipelineAssign a value to a DevOps pipeline variable during the execution of this pipeline.
Parameter | Mandatory | Description |
---|---|---|
Name | yes | The name of the variable to set in the pipeline |
Value | yes | The value of the variable to set in the pipeline |
Example
PS> Set-AzDevOpsVariable "my-variable" "my-variable-value"# #vso[task.setvariable variable=my-variable] my-variable-value
#
Setting ARM outputs to Azure DevOps variable groupStores the Azure Resource Management (ARM) outputs in a variable group on Azure DevOps.
Parameter | Mandatory | Description |
---|---|---|
VariableGroupName | yes | The name of the variable group on Azure DevOps where the ARM outputs should be stored |
ArmOutputsEnvironmentVariableName | no | The name of the environment variable where the ARM outputs are located (default: ArmOutputs ) |
UpdateVariablesForCurrentJob | no | The switch to also set the variables in the ARM output as pipeline variables in the current running job |
Example Without updating the variables in the current job running the pipeline:
PS> Set-AzDevOpsArmOutputsToVariableGroup -VariableGroupName "my-variable-group"# Get ARM outputs from 'ArmOutputs' environment variable# Adding variable $output.Name with value $variableValue to variable group my-variable-group# Retrieving project details# Set properties for update of existing variable group
Include updating the variables in the current job running the pipeline, to immediately make them available to the next pipeline tasks:
PS> Set-AzDevOpsArmOutputsToVariableGroup -VariableGroupName "my-variable-group" -UpdateVariablesForCurrentJob# Get ARM outputs from 'ArmOutputs' environment variable# Adding variable $output.Name with value $variableValue to variable group my-variable-group# Retrieving project details# Set properties for update of existing variable group# The pipeline variable $variableName will be updated to value $variableValue as well, so it can be used in subsequent tasks of the current job. # ##vso[task.setvariable variable=$variableName]$variableValue
Include user-defined environment variable for the ARM outputs:
PS> Set-AzDevOpsArmOutputsToVariableGroup -VariableGroupName "my-variable-group" -ArmOutputsEnvironmentVariableName "MyArmOutputs"# Get ARM outputs from 'MyArmOutputs' environment variable# Adding variable $output.Name with value $variableValue to variable group my-variable-group# Retrieving project details# Set properties for update of existing variable group# The pipeline variable $variableName will be updated to value $variableValue as well, so it can be used in subsequent tasks of the current job.
#
Setting ARM outputs to Azure DevOps pipeline variablesSets the ARM outputs as variables to an Azure DevOps pipeline during the execution of the pipeline.
Parameter | Mandatory | Description |
---|---|---|
ArmOutputsEnvironmentVariableName | no | The name of the environment variable where the ARM outputs are located (default: ArmOutputs ) |
Example
With default ArmOutputs
environment variable containing: "my-variable": "my-value"
:
PS> Set-AzDevOpsArmOutputsToPipelineVariables# Get ARM outputs from 'ArmOutputs' environment variable# The pipeline variable my-variable will be updated to value my-value, so it can be used in subsequent tasks of the current job. # ##vso[task.setvariable variable=my-variable]my-value
With custom MyArmOutputs
environment variable containing: "my-variable": "my-value"
:
PS> Set-AzDevOpsArmOutputsToPipelineVariables -ArmOutputsEnvironmentVariableName "MyArmOutputs"# Get ARM outputs from 'MyArmOutputs' environment variable# The pipeline variable my-variable will be updated to value my-value, so it can be used in subsequent tasks of the current job. # ##vso[task.setvariable variable=my-variable]my-value