Skip to content
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-AzureRmWebApp - unable to pipe into select-object #1544

Closed
mjyeaney opened this issue Dec 28, 2015 · 6 comments
Closed

Get-AzureRmWebApp - unable to pipe into select-object #1544

mjyeaney opened this issue Dec 28, 2015 · 6 comments
Assignees
Labels
App Services aka WebSites Service Attention This issue is responsible by Azure service team.

Comments

@mjyeaney
Copy link

Using AzureRM.Websites, v.1.0.2, I am unable to execute the following command:

Get-AzureRmWebApp | select Name

This returns an empty set of results. However, if we drill down one additional level in the object structure, the following command works:

Get-AzureRmWebApp | foreach { $_.Name }

Expectation is for this to work as other similar cmdlets do. For example:

Get-AzureRmVM | select Name

@hovsepm hovsepm added the App Services aka WebSites label Jan 8, 2016
@anyasabo
Copy link

I can reproduce this on AzureRM.Websites v2.2.0.

Looks like it's because Get-AzureRmWebApp outputs a list to the pipeline:

PS > Get-AzureRmWebApp | gm
   TypeName: System.Collections.Generic.List`1[[Microsoft.Azure.Management.WebSites.Models.Site, Microsoft.Azure.Management.Websites, Version=1.0.0.2, Culture=neutral, 
PublicKeyToken=31bf3856ad364e35]]

where Get-AzureRmVm outputs a VM

PS > get-azurermvm | gm
   TypeName: Microsoft.Azure.Commands.Compute.Models.PSVirtualMachine

Took a look at the differences
https://github.com/Azure/azure-powershell/blob/dev/src/ResourceManager/Websites/Commands.Websites/Cmdlets/WebApps/GetAzureWebApp.cs#L148-L172

https://github.com/Azure/azure-powershell/blob/dev/src/ResourceManager/Compute/Commands.Compute/VirtualMachine/Operation/GetAzureVMCommand.cs#L154

Looks like WriteObject can take a bool enumerateCollection arg, so I think this line in GetAzureWebApp:

            WriteObject(list);

just needs to be changed to

            WriteObject(list, true);

to fix this.

@Falconwmua
Copy link

As a work around you can use:

PS > $list = Get-AzureRMWebApp
PS > $list | Select Name

I agree though the Cmdlet needs to be fixed to output the collection rather than the list.

@cormacpayne
Copy link
Member

@Nking92 @LukaszStem would you mind taking a look at this issue? I believe the solution @jonsabo has provided will fix this problem.

@nking-1
Copy link

nking-1 commented Jan 19, 2017

I'll patch this bug with the provided fix in the next update. Thanks everyone for finding the bug and a fix for it.

@wangting66
Copy link

hi
has this been patched seems to still be occuring?
image

@panchagnula
Copy link
Contributor

@bsiegel bsiegel added the Service Attention This issue is responsible by Azure service team. label Sep 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
App Services aka WebSites Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests

10 participants