{"id":3308,"date":"2022-09-02T15:52:26","date_gmt":"2022-09-02T20:52:26","guid":{"rendered":"https:\/\/microsoftgeek.com\/?p=3308"},"modified":"2022-09-02T15:53:52","modified_gmt":"2022-09-02T20:53:52","slug":"missing-usertype-attribute-in-azure-ad","status":"publish","type":"post","link":"https:\/\/microsoftgeek.com\/?p=3308","title":{"rendered":"Missing \u201cUserType\u201d attribute in Azure AD"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">UserType is not always accurate for identifying external or member users<\/h2>\n\n\n\n<p>If you search an Office 365 user with&nbsp;<em>Get-AzureADUser<\/em>&nbsp;or&nbsp;<em>Get-MsolUser<\/em>, you get details about the account type with the attribute&nbsp;<strong>UserType<\/strong>. The value can be:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Member<\/strong>: the user is part of the Azure AD tenant<\/li><li><strong>Guest<\/strong>: the user is a guest, for example to access to Microsoft Teams or SharePoint site<\/li><\/ul>\n\n\n\n<p>According to&nbsp;<a href=\"https:\/\/techcommunity.microsoft.com\/t5\/azure-active-directory-identity\/prepping-for-new-management-features\/ba-p\/243734\" target=\"_blank\" rel=\"noreferrer noopener\">this Microsoft blog<\/a>, the&nbsp;<strong>UserType<\/strong>&nbsp;attribute was first introduced the 31st August 2014,&nbsp;<strong>so every user created before this date has the UserType attribute empty<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Identify UserType empty<\/h2>\n\n\n\n<p>In my environment, I had a few users with empty UserType. To verify, use one of these two commands (depends on which module you use):<\/p>\n\n\n\n<p><em>Get-AzureADUser -All <strong>$true<\/strong><\/em><\/p>\n\n\n\n<p><em>Get-MsolUser | Select ObjectId,DisplayName,UserPrincipalName,UserType<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/itpro-tips.com\/wp-content\/uploads\/2019\/04\/usertype_aad.png\" alt=\"\" class=\"wp-image-1459\"\/><\/figure>\n\n\n\n<p>When I check the user with UserType empty, I see these users are created before 31st August 2014:<\/p>\n\n\n\n<p><em>Get-MsolUser -All | Where {<strong>$_<\/strong>.UserType -eq <strong>$null<\/strong>} | Select UserPrincipalName, WhenCreated<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/itpro-tips.com\/wp-content\/uploads\/2019\/04\/usertype_aad_empty.png\" alt=\"\" class=\"wp-image-1460\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Fix the UserType issue<\/h2>\n\n\n\n<p>To fix this issue, the UserType has to be filled with&nbsp;<em>Member<\/em>&nbsp;(or Guest for&nbsp;<em>external&nbsp;<\/em>user, but I do not thing external user exist in 2014):<\/p>\n\n\n\n<p><em>Get-MSOLUser -All | Where {<strong>$_<\/strong>.UserType -eq <strong>$null<\/strong>} | Set-MsolUser -UserType Member<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>UserType is not always accurate for identifying external or member users If you search an Office 365 user with&nbsp;Get-AzureADUser&nbsp;or&nbsp;Get-MsolUser, you get details about the account type with the attribute&nbsp;UserType. The value can be: Member: the user is part of the Azure AD tenant Guest: the user is a guest, for example to access to Microsoft [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[42,69,59],"tags":[],"class_list":["post-3308","post","type-post","status-publish","format-standard","hentry","category-ad","category-azure","category-powershell"],"_links":{"self":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/3308","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3308"}],"version-history":[{"count":2,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/3308\/revisions"}],"predecessor-version":[{"id":3310,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=\/wp\/v2\/posts\/3308\/revisions\/3310"}],"wp:attachment":[{"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3308"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3308"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/microsoftgeek.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3308"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}