accounts=$(az ad sp list --show-mine --query [].appDisplayName -otsv)
This will give me an array
I want to pass each item to an array in this command
foreach ($myApp in $accounts){
Get-AzureADApplication -Filter "DisplayName eq $myApp"
}
When I try this I get syntax error at position is this even possible
I'm a noob to powershell
CodePudding user response:
Have you tried enclosing your variable in single quotes?
According to the documentation the value in the filter is quoted:
foreach ($myApp in $accounts){
Get-AzureADApplication -Filter "DisplayName eq '$myApp'"
}