Kaffeeundcode
n8n Flow-Bibliothek
n8n Workflow 01.06.2026

Flow Arbeitsbereich

App Secret Expiry

Flow prüfen, Nodes verstehen, JSON importieren und Credentials sauber anpassen.

Workflow Diagramm

auto-generiert
graph LR
    N0(["⚡ Weekly Schedule"])
    N1["🔧 Get Apps"]
    N2["🔧 Check Secrets"]
    N3{"🔀 If Expiring Found"}
    N4["🔧 Notify Devs"]
    N0 --> N1
    N1 --> N2
    N2 --> N3
    N3 --> N4

    classDef trigger fill:#f59e0b,stroke:#b45309,color:#000
    classDef action fill:#292524,stroke:#44403c,color:#e7e5e4
    classDef logic fill:#1e1b4b,stroke:#4338ca,color:#c7d2fe
    class N0 trigger
    class N1 action
    class N2 action
    class N3 logic
    class N4 action

14_App_Secret_Expiry.json

{
    "name": "14_App_Secret_Expiry",
    "nodes": [
        {
            "parameters": {
                "rule": {
                    "interval": [
                        {
                            "field": "weeks"
                        }
                    ]
                }
            },
            "name": "Weekly Schedule",
            "type": "n8n-nodes-base.schedule",
            "typeVersion": 1,
            "position": [
                250,
                300
            ]
        },
        {
            "parameters": {
                "authentication": "predefinedCredentialType",
                "nodeCredentialType": "microsoftGraphOAuth2Api",
                "requestMethod": "GET",
                "url": "https://graph.microsoft.com/v1.0/applications?$select=displayName,appId,passwordCredentials,keyCredentials",
                "options": {}
            },
            "name": "Get Apps",
            "type": "n8n-nodes-base.httpRequest",
            "typeVersion": 3,
            "position": [
                450,
                300
            ],
            "credentials": {
                "microsoftGraphOAuth2Api": {
                    "id": "YOUR_CREDENTIAL_ID",
                    "name": "Microsoft Graph Account"
                }
            }
        },
        {
            "parameters": {
                "functionCode": "const apps = items[0].json.value;nconst now = new Date();nconst thirtyDays = 30 * 24 * 60 * 60 * 1000;nlet expiring = [];nnapps.forEach(app => {n  app.passwordCredentials.forEach(cred => {n    const end = new Date(cred.endDateTime);n    if ((end - now) < thirtyDays && (end - now) > 0) {n      expiring.push({ app: app.displayName, id: app.appId, type: 'Secret', expires: cred.endDateTime });n    }n  });n});nnreturn [{ json: { expiring, count: expiring.length } }];"
            },
            "name": "Check Secrets",
            "type": "n8n-nodes-base.function",
            "typeVersion": 1,
            "position": [
                650,
                300
            ]
        },
        {
            "parameters": {
                "conditions": {
                    "number": [
                        {
                            "value1": "={{ $json.count }}",
                            "operation": "larger",
                            "value2": 0
                        }
                    ]
                }
            },
            "name": "If Expiring Found",
            "type": "n8n-nodes-base.if",
            "typeVersion": 1,
            "position": [
                850,
                300
            ]
        },
        {
            "parameters": {
                "resource": "chat",
                "message": "=⚠️ **App Registration Secrets Expiring**nFound {{ $json.count }} secrets expiring soon:nn{{ $json.expiring.map(e => `- ${e.app} (${e.expires})`).join('\n') }}"
            },
            "name": "Notify Devs",
            "type": "n8n-nodes-base.microsoftTeams",
            "typeVersion": 1,
            "position": [
                1050,
                300
            ]
        }
    ],
    "connections": {
        "Weekly Schedule": {
            "main": [
                [
                    {
                        "node": "Get Apps",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Get Apps": {
            "main": [
                [
                    {
                        "node": "Check Secrets",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "Check Secrets": {
            "main": [
                [
                    {
                        "node": "If Expiring Found",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        },
        "If Expiring Found": {
            "main": [
                [
                    {
                        "node": "Notify Devs",
                        "type": "main",
                        "index": 0
                    }
                ]
            ]
        }
    }
}