How to transform a multi-value attribute claims into a single string claim in AAD

Zak M 15 Reputation points
2023-04-13T13:39:16.8433333+00:00

Using the multi-values users.AssignedRoles attribute as a claim, creates a saml response like below

<Attribute>
<Attribute Name="AssignedRoles">
<AttributeValue>Sales</AttributeValue>
<AttributeValue>Orders</AttributeValue>
</Attribute>

Is it possible to transform this multi-valued attribute into a custom claim, where the values of the multi-valued attribute have been concatenated or joined into a single string, such as below.

<Attribute>
<Attribute Name="CustomAssignedRoles">
<AttributeValue>Sales:Orders</AttributeValue>
</Attribute>

This is something that is possible in ADFS using claim issuance transform rules. I'm hoping similar functionality is available in AAD.
e.g. of ADFS Claim issuance policy https://aws.amazon.com/blogs/big-data/federate-access-to-amazon-redshift-query-editor-v2-with-active-directory-federation-services-ad-fs-part-3/

  1. Follow the same steps as in the previous section to create the rule Marketing, using the following code for the custom rule:
    c:[Type == "http://temp/variable", Value =~ "(?i)^RSDB-marketing"]
 => add(Type = "http://temp/marketing", Value = RegExReplace(c.Value, "RSDB-", ""));
    ```
    
    
1. Create the rule `MarketingNotExists` using the following code:
    
NOT EXISTS([Type == "http://temp/variable", Value =~ "RSDB-marketing"]) => add(Type = "http://temp/marketing", Value = ""); 
```
  1. Create the rule sales using the following code:
    c:[Type == "http://temp/variable", Value =~ "(?i)^RSDB-sales"]
 => add(Type = "http://temp/sales", Value = RegExReplace(c.Value, "RSDB-", ""));
    ```
    
    
1. Create the rule `SalesNotExists` using the following code:
    
NOT EXISTS([Type == "http://temp/variable", Value =~ "RSDB-sales"])

=> add(Type = "http://temp/sales", Value = ""); ```

  1. Create the rule RedshiftDbGroups using the following code:
    c:[Type == "http://temp/marketing"]  && c2:[Type == "http://temp/sales"]  => issue(Type = "https://aws.amazon.com/SAML/Attributes/customAssignedRoles", Value = c.Value + ":" + c2.Value);
    ```
    
    
    ![User's image](/api/attachments/9f9064d0-ef56-4ded-81c9-92efbdfe627a?platform=QnA)

Microsoft Security Microsoft Entra Microsoft Entra ID
{count} votes

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.