Convert AAD Security Identifier to ObjectId

Hi everyone,

I’m trying a way to convert an azure active directory Sid into an ObjectId. The graph API contains a field which is called SecurityIdentifier but I don’t understand if there is a function to transform it into ObjectID.
Thanks a lot for any information relating to my case.

Hi, I resolved, here the function:
function Convert-AzureSidToObjectId( $azureSid){
$byteArray=[System.Byte]::CreateInstance([System.Byte],16)
$place=0
$blocks=$azureSid.Replace(“S-1-12-1-”,“”).Split(“-”,[System.StringSplitOptions]::RemoveEmptyEntries)
foreach($i in $blocks){
[Buffer]::BlockCopy([bitconverter]::GetBytes([int64]::Parse($i)),0,$byteArray,$place,4)
$place += 4
}
[Guid]::new($byteArray)
}