Hello @punna0001, I deployed the Transform Rule and I tested it with some dummy values and tested in Identity Profile Preview and it looks good.
However, it does not work when I apply this rule and the transform in the Machine Account Mapping.
I tried using hardcoded values in the transform or using the accountAttributes for the nativeIdentity value, but neither is working. It just does not render any results on the account. I tested with another simple transform just to extract the value of the nativeIdentity (in our case we used ARN) and it is working.
Here is my sample transform that referenced the Transform Rule
{
"name": "Test Machine Account Tags",
"type": "firstValid",
"attributes": {
"values": [
{
"attributes": {
"sn": {
"attributes": {
"values": [
{
"attributes": {
"name": "<Transform Rule Name>",
"nativeIdentity": "arn:aws:iam::xxx/yyy/zzz",
"sourceName": "<sourceId>",
"lookupPrefix": "service~",
"sourceAttribute": "Tags"
},
"type": "rule"
},
"NoServiceNumber"
]
},
"type": "firstValid"
},
"ni": {
"attributes": {
"values": [
{
"attributes": {
"sourceName": "<sourceName>",
"attributeName": "ARN"
},
"type": "accountAttribute"
},
"NoNI"
]
},
"type": "firstValid"
},
"value": ServiceNumer: $sn, NativeId: $ni"
},
"type": "static"
},
"Default Tag"
]
},
"internal": false
}
It does not work neither with nested accountAttribute transform in the Rule transform
{
"name": "Test Machine Account Tags",
"type": "firstValid",
"attributes": {
"values": [
{
"attributes": {
"sn": {
"attributes": {
"values": [
{
"attributes": {
"name": "<Transform Rule Name>",
"nativeIdentity": {
"attributes": {
"sourceName": "<sourceName>",
"attributeName": "ARN"
},
"type": "accountAttribute"
},
"sourceName": "<sourceId>",
"lookupPrefix": "service~",
"sourceAttribute": "Tags"
},
"type": "rule"
},
"NoServiceNumber"
]
},
"type": "firstValid"
},
"ni": {
"attributes": {
"values": [
{
"attributes": {
"sourceName": "<sourceName>",
"attributeName": "ARN"
},
"type": "accountAttribute"
},
"NoNI"
]
},
"type": "firstValid"
},
"value": ServiceNumer: $sn, NativeId: $ni"
},
"type": "static"
},
"Default Tag"
]
},
"internal": false
}
Here is the sample Transform rule I used
import java.util.Collection;
String _sourceName = sourceName;
String _nativeIdentity = nativeIdentity;
String _sourceAttribute = sourceAttribute;
String _lookupPrefix = lookupPrefix;
Object rawValues = idn.getRawAccountAttribute(_sourceName, _nativeIdentity, _sourceAttribute);
if (rawValues instanceof Collection) {
for (Object value : (Collection) rawValues) {
if (value != null) {
String tag = value.toString();
if (tag.startsWith(_lookupPrefix)) {
return tag.substring(_lookupPrefix.length());
}
}
}
}
return null;
Any ideas and comments are appreciated, thanks.