I'm primarily comparing objectGUID
against adm-AzureID
.
I don't believe what you said is correct, I've seen AD Users and Azure Users with populated adm-AzureID
attributes.
I've created, and tested, this following Cmdlet:
<#
.SYNOPSIS
Returns whether or not the given Object belongs to an Azure domain
.DESCRIPTION
Checks if InputObject's objectGUID matches it's adm-AzureID
.PARAMETER InputObject
The Adaxes Object that is to be checked. Typically this will be $Context.TargetObject or an object with a base type of Softerra.Adaxes.Adsi.AdmObject
.EXAMPLE
PS> Get-AdxNativeAzureObjectStatus -InputObject $Context.TargetObject
.EXAMPLE
PS> ,$Context.TargetObject | Get-AdxNativeAzureObjectStatus
.NOTES
Take note of the "," prefix in the pipelined example as it's a workaround to prevent array unrolling
#>
Function Get-AdxNativeAzureObjectStatus {
Param(
[Parameter(Mandatory=$true,ValueFromPipeline=$true)]
[Softerra.Adaxes.Adsi.AdmObject]$InputObject
)
$ObjectGUID = try { [Guid]$InputObject.Get("objectGUID") } catch { }
$ObjectAzureID = try { [Guid]$InputObject.Get("adm-AzureID") } catch {}
$null -ne $ObjectAzureID -and $null -ne $ObjectGUID -and $ObjectGUID -eq $ObjectAzureID
}