You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Different versions of SDK and Graph API cause different, inconsistent, behavior for the UserType property.
SDK v1, v1.0 endpoint: Get-MgUser doesn't return UserType by default
SDK v1, beta endpoint: Get-MgUser returns and displays UserType by default
SDK v2, v1.0 endpoint: Get-MgUser doesn't return UserType by default
SDK v2, beta endpoint: Get-MgBetaUser returns UserType, but it's not displayed in the output by default
Behavior also changes when -Property is used, if we get the specified user or list all users
PS>get-mgbetauser-property signinactivity -userid ac4de573-e369-4dcb-bbd2-170c4a0b667c | select usertype
UserType
--------
PS>get-mgbetauser-property signinactivity | select usertype
UserType
--------
Member
Member
...
This is a behavior with the API that's reproducible through Graph Explorer as well. Calling the command with -Debug will return the raw HTTP response from the API.
The API does not return all user properties when fetching a single user and signInActivity is exclusively specified in the $select/-Property:
vs
As a workaround, you can explicitly include userType in the $select/-Property - -property signinactivity, userType.
This repository is intended for issues related to the functionality of the module. We may not be the best place to answer some queries that are tied to the functionality of the API.
@alexandair, this is covered in the known issues - https://github.com/microsoftgraph/msgraph-sdk-powershell#known-issues. Since we use CLR types, only a handful of preselected properties are shown on your terminal by default. You can pipe the command's output to PowerShell's Format-* commands to show all properties/ format the response to your liking.
The change was made as part #2002 to remove the property from the v1.0 response. The output display format config (AutoREST directives) only supports formatting by type names, we can't have unique output display format for v1.0 and beta types:
directive:
- where:
model-name: ^MicrosoftGraphUser\d*$
set:
format-table:
properties:
- DisplayName
- Id
- Mail
- UserPrincipalName
@peombwa I'm confused now. Why can't we have the same output in SDK v1 and SDK v2 for beta endpoint?
SDK v1, beta endpoint: Get-MgUser returns and displays UserType by default
SDK v2, beta endpoint: Get-MgBetaUser returns UserType, but it's not displayed in the output by default
SDK v1, v1.0 endpoint: Get-MgUser doesn't return UserType by default
SDK v2, v1.0 endpoint: Get-MgUser doesn't return UserType by default
Support per module default output formatting (Get-MgUser's and Get-MgBetaUser's UserType property: Now you see it, now you don't) · Issue #2144 · microsoftgraph/msgraph-sdk-powershell
Activity
peombwa commentedon Jul 12, 2023
Thanks for following up on this.
This is a behavior with the API that's reproducible through Graph Explorer as well. Calling the command with
-Debugwill return the raw HTTP response from the API.The API does not return all user properties when fetching a single user and signInActivity is exclusively specified in the


$select/-Property:vs
As a workaround, you can explicitly include
userTypein the$select/-Property--property signinactivity, userType.Please open a question/ticket at https://developer.microsoft.com/en-us/graph/support as this is a service issue. Please include the
requestIdanddateof the affected calls in your ticket/question. See Microsoft Graph PowerShell module troubleshooting guide for more details.This repository is intended for issues related to the functionality of the module. We may not be the best place to answer some queries that are tied to the functionality of the API.
alexandair commentedon Jul 12, 2023
@peombwa This is a PowerShell issue:
SDK v2, beta endpoint: Get-MgBetaUser returns UserType, but it's not displayed in the output by default
peombwa commentedon Jul 12, 2023
@alexandair, this is covered in the known issues - https://github.com/microsoftgraph/msgraph-sdk-powershell#known-issues. Since we use CLR types, only a handful of preselected properties are shown on your terminal by default. You can pipe the command's output to PowerShell's
Format-*commands to show all properties/ format the response to your liking.The change was made as part #2002 to remove the property from the v1.0 response. The output display format config (AutoREST directives) only supports formatting by type names, we can't have unique output display format for v1.0 and beta types:
alexandair commentedon Jul 12, 2023
@peombwa I'm confused now. Why can't we have the same output in SDK v1 and SDK v2 for beta endpoint?
SDK v1, beta endpoint: Get-MgUser returns and displays UserType by default
SDK v2, beta endpoint: Get-MgBetaUser returns UserType, but it's not displayed in the output by default
SDK v1, v1.0 endpoint: Get-MgUser doesn't return UserType by default
SDK v2, v1.0 endpoint: Get-MgUser doesn't return UserType by default
46 remaining items