current_principal_is_member_of()

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

Syntax

current_principal_is_member_of(*list of string literals*)

Arguments

  • list of expressions - a comma-separated list of string literals, where each literal represents an AAD principal. See examples for AAD principals.

Returns

The function returns:

  • true: if the current principal running the query was successfully matched for at least one input argument.
  • false: otherwise

Example

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'
    )
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'
    ]))
result
false

This capability isn't supported in Azure Monitor