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

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

问题描述

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

解决方案

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

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

我们可以使用上面显示的字段之一(例如 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天全站免登陆