Closed jaspain closed 9 months ago
As it applies to Get-MgUser, this bug creates a breaking change in about 20 of my production scripts, so I'm hoping that you are able to address it quickly. Thanks.
This issue also applies to the Get-MgBetaUserCount, and occurred when I updated from v2.12 to v2.13.1. Attached is a picture of the command which is causing the issue and the associated output:
This also applies to MgApplication, it now returns the app object along with ResponseHeaders
I have seen the same for multiple resources, I honestly think this release is so buggy, or if this is by design, introduces so many undocumented changes that it should be removed from PSGallery until it have been fixed, or as a minimum bump the version to indicate a major breaking change
This also applies to MgApplication, it now returns the app object along with ResponseHeaders
I see diff between Get-MgApplication with either filter or by ApplicationId - filter call returns expected , app id returns the headers as well
2.13.1 is not working for me.
Get-MGUser still returns ResponseHeaders, as does Update-MgDirectoryOnPremiseSynchronization
Same problem here. The Array contains the Responseheaders. Array should be only 1 but has a count of 2. Therefore the $Users[1].DisplayName is Empty.
$Users = Get-MgUser -UserId a.bohren@icewolf.ch $Users.Count
Foreach ($User in $Users) { $DisplayName = $User.DisplayName Write-Host "DisplayName: $DisplayName" }
Same Problem exists in Version 2.14.0
Kind Regards Andres
I'm confirming the observation of @BohrenAn that this issue has not been fixed in v2.14.0. In fact, rather than returning just a ResponseHeader object along with the expected user or group object , Get-MgUser and Get-MgGroup are now returning a hashtable with various properties of the query/response as the second element of the returned array:
---- -----
client-request-id {<redacted>}
x-ms-resource-unit {1}
request-id {<redacted>}
Vary {Accept-Encoding}
Date {Sun, 18 Feb 2024 13:34:59 GMT}
Strict-Transport-Security {max-age=31536000}
OData-Version {4.0}
x-ms-ags-diagnostic {{"ServerInfo":{"DataCenter":"South Central US","Slice":"E","Ring":"5","ScaleUnit":"002…
Cache-Control {no-cache}
Transfer-Encoding {chunked}
I did not test other cmdlets. I think my best option for now is to roll back to v2.12.0 until this is fixed.
We are working on a fix on this issue #2600
I'm running into really awkward behavior when using null checks on get-mguser results. It seems even if there is no value returned, it returns a huge array of blank nothingness which is not what it did previously. Details in #2600
Confirming this issue in 2.14.0 with Get-MgServicePrincipalAppRoleAssignment
There is a workaround, but like many here, I have a ton of scripts to update $CheckTeam = Get-MgGroup -Filter "Id eq '$TeamId'" -ErrorAction Stop
This would go for the other cmdlets with this issue.
I'm just thankful that I haven't updated my runbook modules yet!
@kpinel I have resisted using such a workaround, opting to roll back to 2.12.0 instead. This has been broken for about a week, and it looks like the developers are working on fixing it as we speak. I intend to wait it out.
Apparently @timayabi2020 posted a message in this thread some 5 hours ago saying that upgrading to 2.14.1 would solve it but that message appears to have been pulled. And now version 2.4.1 (4, not 14) has been released. It appears that the issue isn't quite sorted yet.
Hi @salbeck-sit the patch 2.14.1 resolves the issue. Please install and confirm. Thanks
Thanks @timayabi2020, I got it.
With v2.14.1, Get-MgUser -UserId <id>
and Get-MgGroup -GroupId <id>
are again returning single [Microsoft.Graph.PowerShell.Models.MicrosoftGraphUser]
and [Microsoft.Graph.PowerShell.Models.MicrosoftGraphGroup]
objects, respectively, as expected.
@timayabi2020 The online documentation Get-MgUser hasn't yet been updated, and it differs from Get-Help -Name Get-MgUser -Full
. While I may not understand correct usage, I don't think the ResponseHeadersVariable
parameter is working as expected. It doesn't modify the supplied variable's value with the response headers. For example:
PS> $r = 'Initial Value'
PS> $u = Get-MgUser -UserId user@mydomain.com -ResponseHeadersVariable r
PS> $u.GetType().FullName
Microsoft.Graph.PowerShell.Models.MicrosoftGraphUser
PS> $r
Initial Value
@jaspain thanks for pointing that out. The parameter is now working as expected in version 2.15.0.
Please note that -RHV
is the alias for -ResponseHeadersVariable
@timayabi2020 Thank you. I'm confirming that -ResponseHeadersVariable
is working as expected in v2.15.0. I think you can close this issue 2584.
Description
Get-MgGroup -GroupId v2.13.1 returns a System.Object[] with two elements: a
Microsoft.Graph.PowerShell.Models.MicrosoftGraphGroup
and aMicrosoft.Graph.PowerShell.ResponseHeaders.ResponseHeader
. The documentation Get-MgGroup states that the output should be a single object of the former type.Similar behavior occurs with
Update-MgGroup
andGet-MgUser
. Other cmdlets not tested.To reproduce
Execute
Get-MgGroup -GroupId <id>
, where<id>
is any valid group Id.Expected behavior
Return only a single
Microsoft.Graph.PowerShell.Models.MicrosoftGraphGroup
object.Debug output
Module version
Environment data