current_principal_is_member_of()

Learn how to use the current_principal_is_member_of() function to check the identity of the principal running the query.

Checks group membership or principal identity of the current principal running the query.

Syntax

current_principal_is_member_of(group)

Parameters

NameTypeRequiredDescription
groupdynamic✔️An array of string literals in which each literal represents a Microsoft Entra principal. See examples for Microsoft Entra principals.

Returns

The function returns true if the current principal running the query is successfully matched for at least one input argument. If not, the function returns false.

Examples

print result=current_principal_is_member_of(
    'aaduser=user1@fabrikam.com', 
    'aadgroup=group1@fabrikam.com',
    'aadapp=66ad1332-3a94-4a69-9fa2-17732f093664;72f988bf-86f1-41af-91ab-2d7cd011db47'
    )

Output

result
false

Using dynamic array instead of multiple arguments:

print result=current_principal_is_member_of(
    dynamic([
    'aaduser=user1@fabrikam.com', 
    'aadgroup=group1@fabrikam.com',
    'aadapp=66ad1332-3a94-4a69-9fa2-17732f093664;72f988bf-86f1-41af-91ab-2d7cd011db47'
    ]))

Output

result
false