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
Use for Clerk sessions, tokens, webhooks, orgs, and security. PROACTIVELY activate for session tokens, JWT templates, getToken(), custom claims, pending sessions, multi-session UX, organizations, roles, permissions, system vs custom permissions, features/plans, MFA/passkeys/password policy/bot protection, Clerk webhooks, Svix signatures, verifyWebhook(), user/org sync, retries/replays, environment variables, custom domains, secret rotation, logs, and auth security reviews. Provides token semantics, webhook idempotency, authorization defaults, and hardening checklist.
tools
Use for Clerk in Next.js. PROACTIVELY activate for @clerk/nextjs setup, App Router auth()/currentUser(), clerkMiddleware(), proxy.ts/middleware.ts, createRouteMatcher(), protected pages/layouts/Route Handlers/Server Actions/API routes/tRPC, auth.protect() role/permission/token checks, ClerkProvider placement, server-only clerkClient, Link prefetch, redirects, 401/404 auth failures, custom domains, __clerk proxy paths, and deployment gotchas. Provides file patterns, server/client boundary rules, matcher templates, and production checks.
development
Use for Clerk frontend auth flows. PROACTIVELY activate for React, JavaScript, Vue, Nuxt, Astro, Expo, React Router, TanStack React Start, or SPA setup; ClerkProvider and publishable-key wiring; SignIn/SignUp/UserButton/UserProfile/OrganizationSwitcher; custom useUser/useAuth/useClerk/useSignIn/useSignUp/useSession/useOrganization flows; multi-session UX; cross-origin getToken() fetches; loading states, redirects, routing, CORS/cookies, or hydration bugs. Provides SDK selection, UI patterns, token-fetch templates, and frontend gotchas.
development
Use for Clerk dev/prod readiness, deployment, and multi-language implementation planning. PROACTIVELY activate for environment variables, pk_test/sk_test vs pk_live/sk_live, local dev, preview/staging/prod instances, domains/DNS, redirects, OAuth credentials, custom domains/proxy, authorizedParties, CSP, CORS/cookies, webhooks/tunnels, Vercel/Netlify/Cloudflare/API gateways, monitoring/troubleshooting, and backends in Node/Express/Fastify, Python/FastAPI/Django/Flask, Go, Ruby/Rails, Java/Spring, .NET, PHP/Laravel. Provides checklists, rollout plans, and language-portable patterns.