Created
March 18, 2024 23:33
-
-
Save vinijmoura/0d5500cc8db5d15f2ac77cf7c36ed940 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clear | |
$PAT='' | |
$Organization='' | |
$Project="" | |
$VariableGroup="" | |
$AzureDevOpsAuthenicationHeader = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$($PAT)")) } | |
$UriOrganization = "https://dev.azure.com/$($Organization)/" | |
$uriVariableGroup = "$($UriOrganization)$($Project)/_apis/distributedtask/variablegroups?groupName=$($VariableGroup)&queryOrder=IdDescending&api-version=7.1-preview.2" | |
$VariableGroupResult = Invoke-RestMethod -Uri $uriVariableGroup -Method get -Headers $AzureDevOpsAuthenicationHeader | |
$AllVariables = ($VariableGroupResult.value[0].variables | Get-Member -MemberType NoteProperty).Name | |
Foreach ($vg in $AllVariables) | |
{ | |
"Varible group name: $($vg)" | |
"Varible group value: $($VariableGroupResult.value[0].variables.$vg.value)" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment