plugins/adf-master/skills/adf-validation-rules/SKILL.md
ADF activity nesting rules, limits, and validation gotchas. PROACTIVELY activate for: (1) ADF activity nesting rules (ForEach inside If, Switch, Until), (2) ForEach limitations (no nested ForEach, item limits), (3) pipeline validation errors and ARM-template build failures, (4) linked service authentication issues, (5) Set Variable restrictions in ForEach, (6) Data Flow constraints (transformation limits, source/sink rules), (7) parameter and variable scope, (8) max activities per pipeline, (9) pipeline concurrency limits. Provides: nesting rule matrix, activity limit reference, validation error catalog, and refactoring patterns for unsupported nesting.
npx skillsauth add JosiahSiegel/claude-plugin-marketplace adf-validation-rulesInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Azure Data Factory has STRICT nesting rules for control flow activities. Violating these rules will cause pipeline failures or prevent pipeline creation.
Four control flow activities support nested activities:
| Parent Activity | Can Contain | Notes | |----------------|-------------|-------| | ForEach | If Condition | ✅ Allowed | | ForEach | Switch | ✅ Allowed | | Until | If Condition | ✅ Allowed | | Until | Switch | ✅ Allowed |
| Parent Activity | CANNOT Contain | Reason | |----------------|----------------|---------| | If Condition | ForEach | ❌ Not supported - use Execute Pipeline workaround | | If Condition | Switch | ❌ Not supported - use Execute Pipeline workaround | | If Condition | Until | ❌ Not supported - use Execute Pipeline workaround | | If Condition | Another If | ❌ Cannot nest If within If | | Switch | ForEach | ❌ Not supported - use Execute Pipeline workaround | | Switch | If Condition | ❌ Not supported - use Execute Pipeline workaround | | Switch | Until | ❌ Not supported - use Execute Pipeline workaround | | Switch | Another Switch | ❌ Cannot nest Switch within Switch | | ForEach | Another ForEach | ❌ Single level only - use Execute Pipeline workaround | | Until | Another Until | ❌ Single level only - use Execute Pipeline workaround | | ForEach | Until | ❌ Single level only - use Execute Pipeline workaround | | Until | ForEach | ❌ Single level only - use Execute Pipeline workaround |
Validation Activity:
The ONLY supported workaround for prohibited nesting combinations:
Instead of direct nesting, use the Execute Pipeline Activity to call a child pipeline:
{
"name": "ParentPipeline_WithIfCondition",
"activities": [
{
"name": "IfCondition_Parent",
"type": "IfCondition",
"typeProperties": {
"expression": "@equals(pipeline().parameters.ProcessData, 'true')",
"ifTrueActivities": [
{
"name": "ExecuteChildPipeline_WithForEach",
"type": "ExecutePipeline",
"typeProperties": {
"pipeline": {
"referenceName": "ChildPipeline_ForEachLoop",
"type": "PipelineReference"
},
"parameters": {
"ItemList": "@pipeline().parameters.Items"
}
}
}
]
}
}
]
}
Child Pipeline Structure:
{
"name": "ChildPipeline_ForEachLoop",
"parameters": {
"ItemList": {"type": "array"}
},
"activities": [
{
"name": "ForEach_InChildPipeline",
"type": "ForEach",
"typeProperties": {
"items": "@pipeline().parameters.ItemList",
"activities": [
// Your ForEach logic here
]
}
}
]
}
Why This Works:
| Resource | Limit | Notes |
|----------|-------|-------|
| Activities per pipeline | 80 | Includes inner activities for containers |
| Parameters per pipeline | 50 | - |
| ForEach concurrent iterations | 50 (maximum) | Set via batchCount property |
| ForEach items | 100,000 | - |
| Lookup activity rows | 5,000 | Maximum rows returned |
| Lookup activity size | 4 MB | Maximum size of returned data |
| Web activity timeout | 1 hour | Default timeout for Web activities |
| Copy activity timeout | 7 days | Maximum execution time |
{
"name": "ForEachActivity",
"type": "ForEach",
"typeProperties": {
"items": "@pipeline().parameters.ItemList",
"isSequential": false, // false = parallel execution
"batchCount": 50, // Max 50 concurrent iterations
"activities": [
// Nested activities
]
}
}
Critical Considerations:
isSequential: true → Executes one item at a time (slow but predictable)isSequential: false → Executes up to batchCount items in parallelbatchCount is 50 regardless of setting❌ CANNOT use Set Variable inside ForEach with isSequential: false
Append Variable with array type, or use sequential executionDetailed validation rules and templates for ADF Linked Services (Azure Blob Storage and Azure SQL Database) — auth types (key, SAS, managed identity, AAD), network configuration, and connection-string patterns — live in references/linked-services.md. Load that reference when authoring or validating a Linked Service JSON.
| Transformation | Limitation | |----------------|------------| | Lookup | Cache size limited by cluster memory | | Join | Large joins may cause memory errors | | Pivot | Maximum 10,000 unique values | | Window | Requires partitioning for large datasets |
accountKind is setbatchCount ≤ 50 if parallel executionCRITICAL: Always run automated validation before committing or deploying ADF pipelines!
The adf-master plugin includes a comprehensive PowerShell validation script that checks for ALL the rules and limitations documented above.
Location: ${CLAUDE_PLUGIN_ROOT}/scripts/validate-adf-pipelines.ps1
Basic usage:
# From the root of your ADF repository
pwsh -File validate-adf-pipelines.ps1
With custom paths:
pwsh -File validate-adf-pipelines.ps1 `
-PipelinePath "path/to/pipeline" `
-DatasetPath "path/to/dataset"
With strict mode (additional warnings):
pwsh -File validate-adf-pipelines.ps1 -Strict
The automated validation script checks for issues that Microsoft's official @microsoft/azure-data-factory-utilities package does NOT validate:
Activity Nesting Violations:
Resource Limits:
Variable Scope Violations:
Dataset Configuration Issues:
Copy Activity Validations:
GitHub Actions example:
- name: Validate ADF Pipelines
run: |
pwsh -File validate-adf-pipelines.ps1 -PipelinePath pipeline -DatasetPath dataset
shell: pwsh
Azure DevOps example:
- task: PowerShell@2
displayName: 'Validate ADF Pipelines'
inputs:
filePath: 'validate-adf-pipelines.ps1'
arguments: '-PipelinePath pipeline -DatasetPath dataset'
pwsh: true
Use the /adf-validate command to run the validation script with proper guidance:
/adf-validate
This command will:
When creating or modifying ADF pipelines:
accountKind for managed identity)Example Validation Response:
❌ INVALID PIPELINE STRUCTURE DETECTED:
Issue: ForEach activity contains another ForEach activity
Location: Pipeline "PL_DataProcessing" → ForEach "OuterLoop" → ForEach "InnerLoop"
This violates Azure Data Factory nesting rules:
- ForEach activities support only a SINGLE level of nesting
- You CANNOT nest ForEach within ForEach
✅ RECOMMENDED SOLUTION:
Use the Execute Pipeline pattern:
1. Create a child pipeline with the inner ForEach logic
2. Replace the inner ForEach with an Execute Pipeline activity
3. Pass required parameters to the child pipeline
Would you like me to generate the refactored pipeline structure?
Official Microsoft Learn Resources:
Last Updated: 2025-01-24 (Based on official Microsoft documentation)
This validation rules skill MUST be consulted before creating or modifying ANY Azure Data Factory pipeline to ensure compliance with platform limitations and best practices.
For detailed validation matrices and resource limits, see:
references/nesting-rules.md - Complete matrix of permitted and prohibited activity nesting combinations with workaround patternsreferences/resource-limits.md - Complete reference for all ADF limits (pipeline, activity, trigger, data flow, integration runtime, expression, API)development
This skill should be used when the user asks to train, debug, scale, or improve ML models. PROACTIVELY activate for: (1) PyTorch, TensorFlow/Keras, JAX, Flax, Hugging Face Trainer/Accelerate training loops, (2) distributed training, DDP/FSDP/DeepSpeed, TPU/GPU setup, (3) mixed precision AMP/bf16, gradient accumulation, checkpointing, seeding, (4) overfitting, imbalance, loss functions, regularization, LR schedules, warmup, (5) memory optimization, gradient checkpointing, offloading, quantization-aware training. Provides: reproducible training best practices across deep learning and classical ML.
development
This skill should be used when the user asks to productionize, track, version, govern, monitor, or automate ML systems. PROACTIVELY activate for: (1) MLflow, Weights & Biases, Neptune, Comet, ClearML experiment tracking, (2) model registry, model versioning, artifact lineage, reproducibility, (3) Kubeflow, SageMaker Pipelines, Vertex AI Pipelines, Azure ML pipelines, Databricks workflows, (4) CI/CD, continuous training/evaluation, A/B tests, canary/shadow deployments, (5) drift detection, model monitoring, data validation, responsible AI governance. Provides: end-to-end MLOps architecture and operational safeguards.
development
This skill should be used when the user asks to optimize, export, serve, compress, or accelerate ML inference. PROACTIVELY activate for: (1) latency, throughput, p95/p99, batching, concurrency, KV cache, memory, or cost issues, (2) quantization INT8/INT4, GPTQ, AWQ, bitsandbytes, pruning, sparsity, distillation, (3) ONNX export, ONNX Runtime, TensorRT, TorchScript, torch.compile, XLA, OpenVINO, Core ML, TFLite, (4) Triton, TorchServe, TF Serving, BentoML, Seldon, KServe configuration, (5) edge deployment, CPU/GPU/TPU/Inferentia serving. Provides: hardware-aware inference optimization and safe benchmarking.
testing
This skill should be used when the user asks to tune hyperparameters, run sweeps, optimize search spaces, or use AutoML. PROACTIVELY activate for: (1) Optuna, Ray Tune, FLAML, AutoGluon, Hyperopt, Nevergrad, KerasTuner, W&B sweeps, (2) grid search, random search, Bayesian optimization, TPE, Gaussian processes, evolutionary search, (3) ASHA, Hyperband, successive halving, multi-fidelity optimization, population-based training, (4) learning-rate finder, batch-size search, early stopping, pruning, (5) reproducible sweep design and experiment analysis. Provides: budget-aware hyperparameter search strategy.