Imagine a retailer accepting orders from a partner webshop. Before an order reaches fulfilment, both teams need to agree on what “accepted” means. If the quantity is missing, the webshop can ask the buyer to correct it. If the partner starts sending the word "two" in a numeric field, the integration team needs evidence of a contract mismatch. Sending both cases to an operator as “order failed” gives the wrong person the work.
Acceptance criteria for the pilot
- A valid order receives an acknowledgement with its order ID. In this lab, acceptance means the order passed validation. Warehouse booking would be a separate step.
- A missing quantity produces a useful rejection that the webshop can act on.
- A malformed quantity can be traced to the exact workflow action so partner support can identify what changed.
The diagram below is the business walkthrough. The rest of the article builds those three cases and shows how to verify each outcome.
This lab uses a stateful Logic Apps Standard workflow with built-in operations. It needs a local Standard runtime and its storage dependency. It calls no business system. The sample below creates the workflow definition and three order files on your workstation. The local CLI is a preview; the commands below follow Microsoft’s published command surface. Local CLI announcement and installation requirements

Create the local project
Start in an empty working directory in PowerShell. Microsoft’s initial preview requires Azure CLI 2.67 or later and Python 3.10 or later in the interpreter that hosts Azure CLI. Record the actual extension version when sharing results with a colleague.
Create the sample files (PowerShell)
Run this block once from the directory where you will create the app.
New-Item -ItemType Directory -Force ./samples/local-cli/fixtures | Out-Null
@'
{
"orderId": "O-1042",
"quantity": 2
}
'@ | Set-Content -Encoding utf8 ./samples/local-cli/fixtures/accepted.json
@'
{
"orderId": "O-1043"
}
'@ | Set-Content -Encoding utf8 ./samples/local-cli/fixtures/missing.json
@'
{
"orderId": "O-1044",
"quantity": "two"
}
'@ | Set-Content -Encoding utf8 ./samples/local-cli/fixtures/wrong-type.json
@'
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"contentVersion": "1.0.0.0",
"triggers": {
"receive_order": {
"type": "Request",
"kind": "Http",
"inputs": {
"schema": {}
}
}
},
"actions": {
"parse_order": {
"type": "ParseJson",
"inputs": {
"content": "@triggerBody()",
"schema": {
"type": "object",
"required": [
"orderId"
],
"properties": {
"orderId": {
"type": "string"
},
"quantity": {
"type": "integer"
}
}
}
},
"runAfter": {}
},
"check_quantity": {
"type": "If",
"expression": {
"greater": [
"@coalesce(body('parse_order')?['quantity'], 0)",
0
]
},
"actions": {
"accept": {
"type": "Response",
"kind": "Http",
"inputs": {
"statusCode": 200,
"body": {
"result": "accepted",
"orderId": "@triggerBody()?['orderId']"
}
}
}
},
"else": {
"actions": {
"reject": {
"type": "Response",
"kind": "Http",
"inputs": {
"statusCode": 422,
"body": {
"result": "quantity must be positive",
"orderId": "@triggerBody()?['orderId']"
}
}
}
}
},
"runAfter": {
"parse_order": [
"Succeeded"
]
}
}
},
"outputs": {}
},
"kind": "Stateful"
}
'@ | Set-Content -Encoding utf8 ./samples/local-cli/workflow.json
az extension add --name logicapp --allow-preview true
az extension show --name logicapp --query version --output tsv
az logicapp project create --path ./app --workflow validate-order --workflow-kind Stateful
az logicapp dependency check --path ./app
az logicapp runtime doctor --path ./app --port 7071
Resolve missing runtime dependencies reported for your OS. For local development storage, make sure the configured Azurite service is available. The project contains the host settings and a workflow folder. Replace the scaffolded definition with the companion file, leaving the generated host configuration in place.
Copy-Item ./samples/local-cli/workflow.json ./app/validate-order/workflow.json
az logicapp workflow validate --path ./app --workflow validate-order
az logicapp runtime start --path ./app --port 7071 --background --ready-timeout 90
az logicapp runtime show --port 7071
az logicapp workflow validate --path ./app --all --with-runtime --local --port 7071
Checkpoint. Look for readiness.managementEndpointReachable set to true and confirm that validate-order is registered. If the host is unreachable, return to runtime doctor and check the local storage service before sending an order.
With the host running, open the app folder in VS Code with the Azure Logic Apps (Standard) extension installed. In Explorer, right-click validate-order/workflow.json, choose Overview, and copy the full Callback URL, including its query string. Paste it at the prompt in the next step. Microsoft’s walkthrough includes a screenshot of the Overview menu.
How the workflow implements the rule
Open app/validate-order/workflow.json alongside the diagram. The Request trigger accepts the incoming body. In parse_order, only orderId is required. Leaving quantity optional is deliberate: an omitted value reaches the business rule, while a text value fails the integer check. In check_quantity, coalesce gives a missing value a default of zero, and the condition accepts values greater than zero.
Send three orders
The trigger accepts a JSON body. The first action,
parse_order, requires a string order ID and checks the type
of quantity when present. The next action, check_quantity,
treats a missing quantity as zero. That division lets you tell malformed
data apart from a valid order that violates a business rule.
$callback = Read-Host 'Local Request callback URL'
curl.exe -i -H "Content-Type: application/json" --data-binary "@samples/local-cli/fixtures/accepted.json" $callback
curl.exe -i -H "Content-Type: application/json" --data-binary "@samples/local-cli/fixtures/missing.json" $callback
curl.exe -i -H "Content-Type: application/json" --data-binary "@samples/local-cli/fixtures/wrong-type.json" $callback
On macOS or Linux use curl in place of
curl.exe. These are the expected outcomes:
| Order | HTTP or workflow outcome | Evidence to look for |
|---|---|---|
| O-1042, quantity 2 | 200, accepted | The accept response ran. |
| O-1043, quantity absent | 422, business rejection | The reject response ran and completed normally. |
| O-1044, quantity is text | Schema validation fails before either response | The failed action is parse_order. Diagnose it from run history; this sample has no custom response for that failure path. |
Find the failure at action level
az logicapp run list --local --port 7071 --workflow validate-order --max-items 10 --output table
$runId = Read-Host 'Run ID for the wrong-type fixture'
az logicapp run action list --workflow validate-order --run-id $runId --local --port 7071
az logicapp run action show --workflow validate-order --run-id $runId --action parse_order --local --port 7071
Match the execution to the test order and timestamp. In the failed
action, look for the disagreement between the integer schema and the
string input. The skipped condition is a consequence. Change the
fixture’s quantity to the number 2 and send it as a fresh request.
Preserve the run IDs from both attempts so the fix is reviewable. Stop
the host with az logicapp runtime stop --port 7071.
Try changing the requirement
Suppose the warehouse introduces a minimum of five units per order. Change the threshold in check_quantity from greater(quantity, 0) to a comparison equivalent to greaterOrEquals(quantity, 5), keeping the existing coalesce expression. Update the rejection message. Revalidate and restart the local host, then send quantities 4 and 5. Expect a 422 for 4 and a 200 for 5. Rerun the string fixture too: changing a commercial rule should leave schema validation intact.
For a production-facing API I would give malformed input its own explicit 400 response and correlate that response with the run. For this first lab, leaving the parse failure visible makes the debugging lesson clear. The same distinction becomes more important behind a queue, where a permanent validation error can otherwise trigger a stream of redeliveries. SDK, CLI and Connector Namespace overview
