src/Public/aad.ps1
function Get-RedkiteAadObjectId { <# .Description Return the objectId for item. For User it expects the UPN (email address) For Application it will return the associated Service Principal objectId #> [CmdletBinding()] param( [parameter(Mandatory = $false)][ValidateSet("Group", "User", "MSI", "Application")][string]$ObjectType = "User", [parameter(ValueFromPipeline, Mandatory = $true)][string]$DisplayName ) $objectId = switch ($ObjectType) { "Group" { getAADGroupObjectId $DisplayName } "Application" { getAADServicePrincipalObjectId $DisplayName } "User" { getAADUserObjectId $DisplayName } "MSI" { getResourceMSI $DisplayName } } return $objectId } |