The basic method for adding group memberships into claims is using Send LDAP Attributes as Claims and picking one of the tokenGroups options.  This method works for global and universal groups, but will leave out any domain local groups.  The primary reason for this is there is no intuitive way to answer which domain to pull these from.


Assuming there is only one domain that the users exist in and AD FS exists in the same domain, there is a workaround for this.  When choosing Send LDAP Attributes as Claims one of the options is Is-Member-of=DL.  This will poll the memberOf attribute and pull the distinguished name of the groups out.  If this format (CN=group,DC=contoso,DC=com) is acceptable, then that is all that needs to be done.

Custom Claim Rules

If the simple name, without the information about the OU is preferred, it can be accomplished with 3 custom claim rules.  There will not be 3 sets of claims added to the token as two of the rules will only add claims to the working set.  The order of the custom rules is important.  It may not function if they are listed out of order in the claim rules window.

Rule 1: 
c:[Type == "", Issuer == "AD AUTHORITY"]
=> add(store = "Active Directory", types = (""), query = ";memberOf;{0}", param = c.Value);

Rule 2:
c:[Type == ""]
=> add(Type = "", Value = regexreplace(c.Value, ",[^\n]*", ""));

Rule 3:
c:[Type == ""]
=> issue(Type = "", Value = regexreplace(c.Value, "^CN=", ""));


The types & can be named anything.  There is no need to rename these to the actual domain name, but doing so would be fine.  The issued claim in rule 3 can be changed to anything as well.

Rule Explainations:

  • Rule 1: Takes all the information from the memberOf attribute and stores it in the phase1 claim set
  • Rule 2: Takes all the claims in the phase1 claim set, removes everything after the first comma, and stores it in the phase2 claim set
  • Rule 3: Takes all the claims in the phase2 claim set, removes the leading CN=, then issues the claim as type

Example: if memberOf contained CN=group,DC=contoso,DC=com

  • Rule 1 would add CN=group,DC=contoso,DC=com as a phase1 claim
  • Rule 2 would add CN=group as a phase2 claim
  • Rule 3 would issue group as a role claim