I have a PowerShell script in Azure DevOps Pipeline that outputs a list of possible IP address that Web App can use:
$deploymentOutputs=(ConvertFrom-Json '$(deploymentOutputs)')
$possibleOutboundIpAddresses=$($deploymentOutputs.possibleOutboundIpAddresses.value)
Write-Host $possibleOutboundIpAddresses
Output looks like this:
23.89.272.2,52.165.130.123,40.222.30.223
How can I transform the PowerShell script to output not comma separated values, but rather output those values as Each-Object?
23.89.272.2
52.165.130.123
40.222.30.223
Ideally, I'd love to also be able to add custom text before the values:
IP1 - 23.89.272.2
IP2 - 52.165.130.123
IP3 - 40.222.30.223
EDIT: The above examples were oversimplification of what I'm trying to do. What I really need to do is to create Azure DevOps variable for each entry in that output. I actually need to perform this PowerShell commands based on the number of IPs and values of IPs:
Write-Host "##vso[task.setvariable variable=$IP1;]23.89.272.2"
Write-Host "##vso[task.setvariable variable=$IP2;]52.165.130.123"
Write-Host "##vso[task.setvariable variable=$IP3;]40.222.30.223"