cfcarrasco It's been a while since I set this up, so I don't remember the exact steps, but here is the code of the "foreach - passwordCreds" loop
{
"type": "Foreach",
"foreach": "@variables('passwordCredentials')",
"actions": {
"Future_time_is_greater_than_endDate_-_passwordCreds": {
"type": "If",
"expression": {
"and": [
{
"greaterOrEquals": [
"@body('Get_future_time')",
"@item()?['endDateTime']"
]
},
{
"and": [
{
"lessOrEquals": [
"@body('Current_time')",
"@variables('expirydate')"
]
}
]
}
]
},
"actions": {
"Append_to_string_variable": {
"type": "AppendToStringVariable",
"inputs": {
"name": "html",
"value": "<tr><td @{variables('styles').cellStyle}>@{variables('displayName')}</td><td @{variables('styles').cellStyle}><a href=\"https://ms.portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationMenuBlade/Credentials/appId/@{variables('appId')}/isMSAApp/\">@{variables('appId')}</a></td><td @{if(less(variables('daystilexpiration'),15),variables('styles').redStyle,if(less(variables('daystilexpiration'),30),variables('styles').yellowStyle,variables('styles').cellStyle))}>@{variables('daystilexpiration')} </td><td @{variables('styles').cellStyle}>Secret</td><td @{variables('styles').cellStyle}>@{formatDateTime(item()?['endDateTime'],'D')}</td></tr>"
},
"runAfter": {
"Set_variable": [
"Succeeded"
]
}
},
"EndTimeTickValue": {
"type": "Compose",
"inputs": "@ticks(item()?['endDateTime'])"
},
"StartTimeTickValue": {
"type": "Compose",
"inputs": "@ticks(utcnow())",
"runAfter": {
"EndTimeTickValue": [
"Succeeded"
]
}
},
"DifferenceAsDays": {
"type": "Compose",
"inputs": "@div(div(div(mul(sub(outputs('EndTimeTickValue'),outputs('StartTimeTickValue')),100),1000000000), 3600), 24)",
"runAfter": {
"StartTimeTickValue": [
"Succeeded"
]
}
},
"Set_variable": {
"type": "SetVariable",
"inputs": {
"name": "daystilexpiration",
"value": "@outputs('DifferenceAsDays')"
},
"runAfter": {
"DifferenceAsDays": [
"Succeeded"
]
}
}
},
"else": {
"actions": {}
},
"runAfter": {
"Set_variable_-_password_expirydate": [
"Succeeded"
]
}
},
"Set_variable_-_password_expirydate": {
"type": "SetVariable",
"inputs": {
"name": "expirydate",
"value": "@item()?['endDateTime']"
}
}
},
"runAfter": {
"Set_variable_-_keyCredentials": [
"Succeeded"
]
},
"runtimeConfiguration": {
"concurrency": {
"repetitions": 1
}
}
}