id: azure-blob-function-servicebus-chain
namespace: company.team
description: |
Chain Blob Storage, an Azure Function, Service Bus, and Data Factory in one
execution. A blob arrival triggers a Function transform, the result is
published to Service Bus for downstream consumers, and a Data Factory
pipeline runs the heavier processing, all under one execution ID.
triggers:
- id: blob_landed
type: io.kestra.plugin.azure.storage.blob.Trigger
description: Fires when a new order file lands in the incoming container.
interval: PT1M
endpoint: "https://{{ secret('AZURE_STORAGE_ACCOUNT') }}.blob.core.windows.net"
connectionString: "{{ secret('AZURE_CONNECTION_STRING') }}"
container: incoming
prefix: orders/
action: MOVE
moveTo:
container: incoming
name: archive/orders/
tasks:
- id: transform
type: io.kestra.plugin.azure.function.HttpFunction
description: Call the Azure Function that validates and reshapes the new blob.
httpMethod: POST
url: "https://{{ secret('AZURE_FUNCTION_APP')
}}.azurewebsites.net/api/TransformOrder?code={{
secret('AZURE_FUNCTION_CODE') }}"
httpBody:
container: "{{ trigger.blobs[0].name }}"
name: "{{ trigger.blobs[0].name }}"
- id: publish_to_servicebus
type: io.kestra.plugin.azure.servicebus.Publish
description: Announce the transformed order to every downstream subscriber.
queueName: orders-transformed
tenantId: "{{ secret('AZURE_TENANT_ID') }}"
clientId: "{{ secret('AZURE_CLIENT_ID') }}"
clientSecret: "{{ secret('AZURE_CLIENT_SECRET') }}"
serdeType: JSON
from:
body: "{{ outputs.transform.repsonseBody }}"
- id: run_pipeline
type: io.kestra.plugin.azure.datafactory.CreateRun
description: Kick off the Data Factory pipeline that lands the order in the warehouse.
factoryName: "{{ secret('ADF_FACTORY_NAME') }}"
pipelineName: process_transformed_orders
resourceGroupName: "{{ secret('AZURE_RESOURCE_GROUP') }}"
subscriptionId: "{{ secret('AZURE_SUBSCRIPTION_ID') }}"
tenantId: "{{ secret('AZURE_TENANT_ID') }}"
clientId: "{{ secret('AZURE_CLIENT_ID') }}"
clientSecret: "{{ secret('AZURE_CLIENT_SECRET') }}"
- id: notify
type: io.kestra.plugin.microsoft365.teams.TeamsIncomingWebhook
description: Post the chain's outcome to the ops channel.
url: "{{ secret('TEAMS_WEBHOOK') }}"
payload: |
{
"type": "message",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.4",
"body": [
{
"type": "TextBlock",
"size": "Large",
"weight": "Bolder",
"text": "Blob to Data Factory chain complete"
},
{
"type": "TextBlock",
"text": "Blob: {{ trigger.blobs[0].name }}",
"wrap": true
},
{
"type": "TextBlock",
"text": "Data Factory run: {{ outputs.run_pipeline.runId }}",
"wrap": true
}
]
}
}
]
}