I'm creating a release pipeline using one Azure PowerShell Task and PowerShell task. In the the Azure Powershell Task, I have the following code
$groupInfos = @()
for ([int]$i = 0; $i -lt $azureADGroupsObj.Count)
{
$groupInfo = New-Object PSObject
$groupInfo | Add-Member -MemberType NoteProperty -Name "displayName" -Value $azureADGroupsObj[$i].DisplayName
$groupInfo | Add-Member -MemberType NoteProperty -Name "Id" -Value
$azureADGroupsObj[$i].Id
$groupInfos += $groupInfo
$i++
}
return $groupInfos
Write-Host "##vso[task.setvariable variable=azureADGroups;]$groupInfos"
I am trying to store $groupInfos into azureADGroups variable here.
but when I run a PowerShell task in the next step under same job, it says the term "azureADGroup" is not recognized.. seems like the variable wasn't set..does anyone know what am I missing here?
Write-Host $env:azureADGroups
– 4c74356b41