PowerApp to Delete Montir Emails e.g. Azure: Activated Severity emails once the Azure: Deactivated Severity has been recieved

{
  "name": "1200139d-495b-4846-8379-10c8abc2117a",
  "id": "/providers/Microsoft.Flow/flows/1200139d-495b-4846-8379-10c8abc2117a",
  "type": "Microsoft.Flow/flows",
  "properties": {
    "apiId": "/providers/Microsoft.PowerApps/apis/shared_logicflows",
    "displayName": "Clean Azure VPN Alerts",
    "definition": {
      "metadata": {
        "workflowEntityId": null,
        "processAdvisorMetadata": null,
        "flowChargedByPaygo": null,
        "flowclientsuspensionreason": "None",
        "flowclientsuspensiontime": null,
        "flowclientsuspensionreasondetails": null,
        "creator": {
          "id": "4a35c6fc-e945-4f70-8791-ba7ea5900e7f",
          "type": "User",
          "tenantId": "e417d5cc-e5d8-4cad-b2cd-c5ef82dea0a0"
        },
        "provisioningMethod": "FromDefinition",
        "failureAlertSubscription": true,
        "clientLastModifiedTime": "2025-04-10T06:58:29.3779237Z",
        "connectionKeySavedTimeKey": "2025-04-10T06:58:29.3779237Z",
        "creationSource": "Portal",
        "modifiedSources": "Portal"
      },
      "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
      "contentVersion": "1.0.0.0",
      "parameters": {
        "$authentication": {
          "defaultValue": {
            
          },
          "type": "SecureObject"
        },
        "$connections": {
          "defaultValue": {
            
          },
          "type": "Object"
        }
      },
      "triggers": {
        "When_a_new_email_arrives_(V3)": {
          "splitOn": "@triggerOutputs()?['body/value']",
          "type": "OpenApiConnectionNotification",
          "inputs": {
            "parameters": {
              "includeAttachments": false,
              "importance": "Any",
              "fetchOnlyWithAttachment": false,
              "folderPath": "Inbox"
            },
            "host": {
              "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365",
              "connectionName": "shared_office365",
              "operationId": "OnNewEmailV3"
            },
            "authentication": "@parameters('$authentication')"
          }
        }
      },
      "actions": {
        "Condition_1": {
          "actions": {
            "DeleteEmail1": {
              "runAfter": {
                "For_each": [
                  "Succeeded"
                ]
              },
              "metadata": {
                "flowSystemMetadata": {
                  "portalOperationIconOverride": "https://conn-afd-prod-endpoint-bmc9bqahasf3grgk.b01.azurefd.net/releases/v1.0.1722/1.0.1722.3975/office365/icon.png",
                  "portalOperationBrandColorOverride": "#0078D4",
                  "portalOperationId": "/providers/Microsoft.PowerApps/apis/shared_office365/apiOperations/DeleteEmail_V2"
                }
              },
              "type": "OpenApiConnection",
              "inputs": {
                "parameters": {
                  "messageId": "@triggerOutputs()?['body/id']"
                },
                "host": {
                  "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365",
                  "connectionName": "shared_office365",
                  "operationId": "DeleteEmail_V2"
                },
                "authentication": "@parameters('$authentication')"
              }
            },
            "Get_emails_(V3)": {
              "type": "OpenApiConnection",
              "inputs": {
                "parameters": {
                  "from": "[email protected]",
                  "fetchOnlyUnread": true,
                  "searchQuery": "subject:'Activated Severity'",
                  "top": 25
                },
                "host": {
                  "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365",
                  "connectionName": "shared_office365",
                  "operationId": "GetEmailsV3"
                },
                "authentication": "@parameters('$authentication')"
              }
            },
            "For_each": {
              "foreach": "@outputs('Get_emails_(V3)')?['body/value']",
              "actions": {
                "Delete_email_(V2)": {
                  "type": "OpenApiConnection",
                  "inputs": {
                    "parameters": {
                      "messageId": "@item()?['id']"
                    },
                    "host": {
                      "apiId": "/providers/Microsoft.PowerApps/apis/shared_office365",
                      "connectionName": "shared_office365",
                      "operationId": "DeleteEmail_V2"
                    },
                    "authentication": "@parameters('$authentication')"
                  }
                }
              },
              "runAfter": {
                "Get_emails_(V3)": [
                  "Succeeded"
                ]
              },
              "type": "Foreach"
            }
          },
          "runAfter": {
            
          },
          "else": {
            "actions": {
              
            }
          },
          "expression": {
            "and": [
              {
                "equals": [
                  "@triggerOutputs()?['body/subject']",
                  "Azure: Deactivated Severity: 3 VPNConnection"
                ]
              }
            ]
          },
          "type": "If"
        }
      },
      "outputs": {
        
      }
    },
    "connectionReferences": {
      "shared_office365": {
        "connectionName": "shared-office365-96b1849c-c7f2-4c88-8789-5410edf28b88",
        "source": "Embedded",
        "id": "/providers/Microsoft.PowerApps/apis/shared_office365",
        "tier": "NotSpecified",
        "apiName": "office365"
      }
    },
    "flowFailureAlertSubscribed": false,
    "isManaged": false
  }
}

https://github.com/pariswells/public-code/blob/master/PowerApps/CleanAzureVPNAlerts_20250410070955.zip

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...