如何列出 Entra ID 租户内的所有目录扩展定义。
Get-MgDirectoryObjectAvailableExtension
仅返回一些源自多租户应用程序的目录扩展定义:
返回所有已注册的目录扩展定义 在目录中,包括通过多租户应用程序。
特别是,不会返回在租户中的应用程序上创建的目录扩展定义。它们由
Get-MgApplicationExtensionProperty -ApplicationId ApplicationId
返回,这需要应用程序 ID。
要列出 Microsoft Entra ID 租户中的所有目录扩展定义,请使用以下 PowerShell 脚本作为解决方法:
# Retrieve all applications in the tenant
$applications = Get-MgApplication
$allExtensions = @()
# Loop through each application to get its extension properties
foreach ($app in $applications) {
$extensions = Get-MgApplicationExtensionProperty -ApplicationId $app.Id
$allExtensions += $extensions
}
# Retrieve available extension properties for directory objects
$directoryExtensions = Get-MgDirectoryObjectAvailableExtensionProperty
# Combine both results
$allExtensions += $directoryExtensions
$allExtensions