title: Azure DevOps Azure PowerShell task output variable
body: <p><a href="https://i.stack.imgur.com/nXfWI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nXfWI.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/AaWQh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AaWQh.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/Lg8gF.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Lg8gF.jpg" alt="enter image description here"></a></p>
  
  <p>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</p>
  
  <pre><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"
  </code></pre>
  
  <p>I am trying to store $groupInfos into azureADGroups variable here.</p>
  
  <p><a href="https://i.stack.imgur.com/Lg8gF.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Lg8gF.jpg" alt="enter image description here"></a></p>
  
  <p>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?</p>