forEach($subscription in Get-AzureRmSubscription) {
Select-AzureRmSubscription -SubscriptionId $subscription.Id | Out-Null
Get-AzurermVM -Status | select $subscription.Name, ResourceGroupName, Name,
PowerState | ConvertTo-Csv -NoTypeInformation -Delimiter "|"}
I'm trying to return the results of this query, but it does not include the subscription name in the results. It shows it in the table header, but not in each line of the results. It should show it on every line, but it is blank for the first column on each row. I'm guessing this has to do with the subscription variable not being apart of the -Status properties, but it shows it in the table header?