ADFS Custom Rule with Two Attributes

Richard Long 341 Reputation points
2021-04-13T17:03:36.77+00:00

We are configuring ADFS (on Server 2012 R2) to support multiple AWS accounts. We plan to leverage an LDAP attribute to determine the user's role, and a second attribute to specify the AWS account number the user should be authenticated to.

We have this working with the user's role populated in an LDAP attribute, but the AWS account number is hardcoded in the claim right now, so we're looking for some guidance getting that put into a claim correctly.

Here is what we are trying:

Get Attributes Claim Rule (Rule template: Send claims using a custom rule)
c1:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname", Issuer == "AD AUTHORITY"]
=> add(store = "Active Directory", types = ("http://temp/variable"), query = ";ad-attribute1;{0}", param = c.Value1);
c2:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname", Issuer == "AD AUTHORITY"]
=> add(store = "Active Directory", types = ("http://temp/variable"), query = ";ad-attribute2;{0}", param = c.Value2);

AWS Role (Rule template: Send claims using a custom rule)
c:[Type == "http://temp/variable"]
=> issue(Type = "https://aws.amazon.com/SAML/Attributes/Role", Value = "arn:aws:iam::" + c.Value2 ":saml-provider/our-adfs,arn:aws:iam::" + c.Value2 ":role/" + c.Value1);

The value we are trying to achieve will be structured like this:
arn:aws:iam::111111111111:saml-provider/our-adfs,arn:aws:iam::111111111111:role/rolename

Microsoft Security Active Directory Federation Services
{count} votes

Accepted answer
  1. Pierre Audonnet - MSFT 10,191 Reputation points Microsoft Employee
    2021-05-12T01:52:26.733+00:00

    Something like this should do the trick:

    c:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname", Issuer == "AD AUTHORITY"]
    => add(store = "Active Directory", types = ("claims:temp/attribute1","claims:temp/attribute2"), query = ";ad-attribute1,ad-attribute2;{0}", param = c.Value);
    
    
    c1:[Type == "claims:temp/attribute1"] && c2:[Type == "claims:temp/attribute2"]
    => issue(Type = "https://aws.amazon.com/SAML/Attributes/Role", Value = "arn:aws:iam::" + c2.Value ":saml-provider/our-adfs,arn:aws:iam::" + c2.Value ":role/" + c1.Value);
    

    You would need to replace the name of the attribute you are really using in the first rule ad-attribute1 and ad-attribute2 and it is assuming that the final format is what you really need.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.