C# 查找用户是否从 Windows Server AD 迁移到 Microsoft Azure [英] C# to find if a user was migrated from Windows Server AD to Microsoft Azure

查看:24
本文介绍了C# 查找用户是否从 Windows Server AD 迁移到 Microsoft Azure的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的个人 Azure 帐户中,我从一个Windows Server AD 迁移了一些用户,有些是直接在 Azure AD 中创建的,还有一些用户来自 Microsoft Personal 帐户.我已经能够使用

解决方案

我认为您可以通过以 onPremises 开头的字段区分用户与(或不来自)Windows Server AD.如果用户来自 Windows Server AD,则字段 onPremises... 不会为空.如果不是来自 Windows Server AD,则这些字段应为空.请参考以下截图:

====================================更新====================================

我们可以使用上面显示的字段之一(例如OnPremisesUserPrincipalName)来判断用户是否来自Windows Server AD.

In my personal Azure account, I migrated some users from a Windows Server AD, and some were created directly in Azure AD, and some users came from Microsoft Personal accounts. I have been able to display these users in a Windows Desktop app using Microsoft Graph - similar to what we see in Azure Portal (as shown below). Moreover, as shown below, the Source of user list in Azure portal tells you whether a user was migrated from Windows Server AD or not. But I have not been able to find a way to programmatically find out if the user was migrated from Windows Server AD or not. Question: Is there an MS Graph API or some other way to programmatically find out out if user was migrated from Windows Server AD or not?

Remark: Although I am using UWP, but it should not matter. A suggestion can be related to any type of app as long as the language is C#.

To get users list:

// Get the Graph client from the provider
var graphClient = ProviderManager.Instance.GlobalProvider.Graph;

 var users = await graphClient.Users.Request()
    .Select("displayName, userPrincipalName, userType")
     .GetAsync();

Users shown in Azure Portal [For Source Column in my Windows Desktop app, I need to determine whether user was migrated from Windows Server AD or not]:

解决方案

I think you can distinguish the user from(or not from) Windows Server AD by the fields start with onPremises. If the user comes from Windows Server AD, the fields onPremises... will not be null. If not from Windows Server AD, the fields should be null. Please refer to below screenshot:

===================================Update==================================

We can use one of the fields which shown above(such as OnPremisesUserPrincipalName) to judge if the user from Windows Server AD or not.

这篇关于C# 查找用户是否从 Windows Server AD 迁移到 Microsoft Azure的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆