-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Convert-ImmutableID.ps1
33 lines (29 loc) · 980 Bytes
/
Convert-ImmutableID.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function Convert-ImmutableID {
<#
.SYNOPSIS
Converts O365 ImmutableID to ActiveDirectory objectGUID
.DESCRIPTION
Converts O365 ImmutableID check cloud user against on-premises
.PARAMETER ImmutableID
The Immutable ID from O365/AzureAD which is a base-64 encoded version of the AD objectGUID
.EXAMPLE
Convert-ImmutableID 't3sJlM0QekeUJ32kOEe1hg=='
.NOTES
You can get the ImmutableID running:
Get-AzureADUser -ObjectId [email protected] | Select-Object immutableid
#>
[CmdletBinding()]
Param (
[Parameter(Mandatory=$true,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true)]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[string]$ImmutableID
)
process {
[PSCustomObject]@{
objectGUID = New-Object -TypeName guid (,[System.Convert]::FromBase64String($immutableid))
}
}
}