Skip to content
Back to Blog
1 min read

Azure Logic Apps: Connectors for Everything

CategoryConnectors
MicrosoftOffice 365, SharePoint, Dynamics 365, Teams
DataSQL Server, Cosmos DB, Azure Blob, Excel
CommunicationOutlook, Twilio, SendGrid, Slack
SocialTwitter, Facebook, LinkedIn
EnterpriseSAP, Salesforce, ServiceNow

Basic Workflow

{
    "definition": {
        "$schema": "https://schema.management.azure.com/schemas/2016-06-01/workflowdefinition.json#",
        "triggers": {
            "When_a_new_email_arrives": {
                "type": "ApiConnection",
                "inputs": {
                    "host": {
                        "connection": {
                            "name": "@parameters('$connections')['office365']['connectionId']"
                        }
                    },
                    "method": "get",
                    "path": "/v2/Mail/OnNewEmail"
                }
            }
        },
        "actions": {
            "Send_Teams_message": {
                "type": "ApiConnection",
                "inputs": {
                    "body": {
                        "body": {
                            "content": "New email from @{triggerBody()?['from']}"
                        }
                    },
                    "host": {
                        "connection": {
                            "name": "@parameters('$connections')['teams']['connectionId']"
                        }
                    },
                    "method": "post",
                    "path": "/v3/beta/teams/@{encodeURIComponent('team-id')}/channels/@{encodeURIComponent('channel-id')}/messages"
                }
            }
        }
    }
}

HTTP Triggers

Accept webhooks from any source.

{
    "triggers": {
        "manual": {
            "type": "Request",
            "kind": "Http",
            "inputs": {
                "schema": {
                    "type": "object",
                    "properties": {
                        "orderId": { "type": "string" },
                        "amount": { "type": "number" }
                    }
                }
            }
        }
    }
}

Conditions and Loops

{
    "actions": {
        "Condition": {
            "type": "If",
            "expression": {
                "and": [
                    {
                        "greater": ["@triggerBody()?['amount']", 1000]
                    }
                ]
            },
            "actions": {
                "Send_approval_email": { }
            },
            "else": {
                "actions": {
                    "Auto_approve": { }
                }
            }
        },
        "For_each_item": {
            "type": "Foreach",
            "foreach": "@triggerBody()?['items']",
            "actions": {
                "Process_item": { }
            }
        }
    }
}

SQL Connector

{
    "Get_rows": {
        "type": "ApiConnection",
        "inputs": {
            "host": {
                "connection": {
                    "name": "@parameters('$connections')['sql']['connectionId']"
                }
            },
            "method": "get",
            "path": "/datasets/default/tables/@{encodeURIComponent('Orders')}/items",
            "queries": {
                "$filter": "Status eq 'Pending'"
            }
        }
    },
    "Insert_row": {
        "type": "ApiConnection",
        "inputs": {
            "body": {
                "OrderId": "@triggerBody()?['orderId']",
                "Status": "Processed",
                "ProcessedDate": "@utcNow()"
            },
            "host": {
                "connection": {
                    "name": "@parameters('$connections')['sql']['connectionId']"
                }
            },
            "method": "post",
            "path": "/datasets/default/tables/@{encodeURIComponent('ProcessedOrders')}/items"
        }
    }
}

Custom Connectors

Create connectors for your APIs.

# OpenAPI definition for custom connector
swagger: "2.0"
info:
  title: "My Custom API"
  version: "1.0"
host: "api.mycompany.com"
schemes: ["https"]
paths:
  /orders:
    get:
      summary: "Get orders"
      operationId: "GetOrders"
      responses:
        200:
          description: "Success"
          schema:
            type: array
            items:
              $ref: "#/definitions/Order"
definitions:
  Order:
    type: object
    properties:
      id:
        type: string
      total:
        type: number

Enterprise Integration

┌─────────────┐     ┌─────────────┐     ┌─────────────┐
│ Salesforce  │────▶│ Logic App   │────▶│ Dynamics    │
│  (Trigger)  │     │ (Transform) │     │   365       │
└─────────────┘     └─────────────┘     └─────────────┘
                           │
                           ▼
                    ┌─────────────┐
                    │  ServiceNow │
                    │  (Ticket)   │
                    └─────────────┘

Logic Apps is the integration glue for enterprise systems.

Michael John Peña

Michael John Peña

Data & AI Director and Microsoft MVP based in Sydney. Writing about Microsoft Fabric, Azure, data engineering, and AI.