Getting first value in a returned object with powershell
There is always an alternative in PowerShell:
$hostnames = Get-AzureRmWebApp -ResourceGroupName "app-rg" -Name "app" | Select-Object -ExpandProperty hostnames -First 1
In powershell, when you reference properties of an item in a list, you interact with them as a list. So you can simply do the following:
$hostnames = (Get-AzureRmWebApp).HostNames$hostnames[0]
To get the first one.