-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get-AzAks: Strange Output type System.Linq.Enumerable #9847
Comments
I have looked at the behavior and could reproduce the error. In my opinion there is something wrong with the response type because the Type If we look at the Code in the var kubeClusters = string.IsNullOrEmpty(ResourceGroupName)
? Client.ManagedClusters.List()
: Client.ManagedClusters.ListByResourceGroup(ResourceGroupName);
WriteObject(kubeClusters.Select(PSMapper.Instance.Map<PSKubernetesCluster>)); I am a bit confused about the Wouldn't something like the following code also do the job or is there a specific reason for running a Select before mapping the var kubeClusters = string.IsNullOrEmpty(ResourceGroupName)
? Client.ManagedClusters.List()
: Client.ManagedClusters.ListByResourceGroup(ResourceGroupName);
WriteObject(PSMapper.Instance.Map<PSKubernetesCluster>(kubeClusters)); |
Removed Select Statement from WriteObject Function in order to Debug Azure#9847
Removed Select Statement from WriteObject Function in order to Debug Azure#9847
@TheKingIGER thanks for filing this issue -- I have opened a PR with the fix here |
Is the issue fixed? I am able to reproduce the issue. |
Description
I found some strange behavior of the Get-AzAks Cmdlet. Everthing is descripted in the Steps to reproduce section
Steps to reproduce
Using the .Count property of the
$aks
variable the output will be 1 1 instead of 2When using an index (
$aks[0]
), the output will be all objects from the Array.The return type of the Commands is a little bit strange. It's not a
System.Object[]
like other cmdlets (e.g.Get-AzVm
).Working Workarounds:
$aks.count -> ($aks.count).Count or ($aks.name).Count
$aks[0] -> foreach
Environment data
Module versions
Debug output
Error output
The text was updated successfully, but these errors were encountered: