获取Azure AD Connect同步状态通过API [英] Get Azure AD Connect Sync status trough API
问题描述
对于我正在开发的某些软件,我想知道Azure AD Connect同步到Office 365/Azure AD是否成功.该软件基于云,并且没有与内部部署的连接.Office 365仪表板使用此URL( https://admin.microsoft.com/admin/api/DirSyncManagement/manage )以获取此信息.我在Graph API中找不到类似的函数来检索此信息.有人知道获取此信息的方法吗?
For some software I'm developing I want to know if the Azure AD Connect sync to Office 365/Azure AD is successful. The software is Cloud based and has no connection to the on-premise. The Office 365 Dashboard uses this url (https://admin.microsoft.com/admin/api/DirSyncManagement/manage) to get this information. I can't find a similar function in the Graph API to retrieve this information. Does anyone know a way to get this information?
推荐答案
并非所有这些功能都可以在面向公众的API中使用,但是有些功能是可用的.使用Microsoft 365管理门户中的当前标签:
Not all of this is available in public-facing APIs, but some things are. Using the current labels from the Microsoft 365 Admin portal:
- 已启用目录同步":Microsoft Graph(v1.0)中的
onPremisesSyncEnabled
onPremisesLastSyncDateTime onPremisesLastPasswordSyncDateTime
- "Directory sync enabled":
onPremisesSyncEnabled
from Microsoft Graph (v1.0) organization entity - "Last directory sync":
onPremisesLastSyncDateTime
from Microsoft Graph (v1.0) organization entity - "Password sync":
onPremisesLastPasswordSyncDateTime
from Microsoft Graph (beta) organization entity
所有这些以及目录同步服务帐户"和已启用密码同步"当前可用于旧版Azure AD PowerShell模块( MSAL ),但以我的经验,.NET Core通常不值得为此付出努力.)
All of these plus "Directory sync service account" and "Password sync enabled" are currently available with the older Azure AD PowerShell module (MSOnline). With .NET Framework, you could use C# to run Get-MsolCompanyInformation and get what you need from the results (using the -AdGraphAccessToken
parameter of Connect-MsolService
to provide an access token you obtain using MSAL, for example), but in my experience, trying to do this with .NET Core is often not worth the effort.)
这篇关于获取Azure AD Connect同步状态通过API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!