Skip to content
| Marketplace
Sign in
Azure DevOps>Azure Pipelines>Validate Json Config
Validate Json Config

Validate Json Config

Vikansys AB

|
1 install
| (0) | Free
Validates that all json file properties in zip or folder have valid environment variables.
Get it free

Validate JSON Config

Test Status Visual Studio Marketplace Installs - Azure DevOps Extension Azure DevOps Marketplace

Azure DevOps task that validates your appsettings.json (or other config JSON) against environment variables, ensuring nothing is missing before deployment.
Supports both raw JSON files and zipped builds. Designed to work well alongside FileTransform@2 or any setup that binds configuration from environment variables.


Why?

Missing environment variable mappings can cause silent runtime failures or unexpected defaults in production.
This task makes config validation part of your CI/CD pipeline, so you catch mistakes before deployment.


Features

  • ✅ Supports zip archives (e.g. build outputs) or folder scans
  • ✅ Matches ASP.NET Core env var conventions (Foo__Bar) and single-underscore (Foo_Bar)
  • ✅ Configurable onError behavior:
    • error → fail pipeline
    • warning → succeed with issues
  • ✅ Ignore specific keys or namespaces with glob patterns (matched against flattened JSON paths, e.g. Logging.*, Serilog.*, Cors.*, FeatureFlags.*, Host.*)
  • ✅ Works on Windows/Linux/macOS agents (PowerShell Core)
  • ✅ Parent matching: if a parent key has an environment variable, all its child keys are treated as covered.

Limitations

  • 🚫 Validation stops at arrays: elements will not be validated. Only the parent (Cors.AllowedOrigins) is checked.
    See example in the mapping table below.

Environment Variable Mapping Examples

Here’s how environment variables are translated:

Environment Variable Mapped Path JSON Key Path
ConnectionStrings_Default ConnectionStrings.Default { "ConnectionStrings": { "Default": "..." } }
Logging_LogLevel_Default Logging.LogLevel.Default { "Logging": { "LogLevel": { "Default": "..." } } }
Cors_AllowedOrigins Cors.AllowedOrigins { "Cors": { "AllowedOrigins": ["..."] } }
Cors_AllowedOrigins_0 (not validated) { "Cors": { "AllowedOrigins": ["..."] } }
FeatureFlags_NewFeature FeatureFlags.NewFeature { "FeatureFlags": { "NewFeature": true } }
Host_Settings_Region Host.Settings.Region { "Host": { "Settings": { "Region": "..." } } }

Installation

After installing from the Azure DevOps Marketplace,
the task will be available in the task picker as Validate Json Config.

In YAML pipelines, use:

- task: ValidateJsonConfig@1
  inputs:
    path: '$(Build.SourcesDirectory)'
    fileType: 'json'

Usage

Example — Validate zipped publish output

steps:
- task: ValidateJsonConfig@1
  inputs:
    path: '$(Build.ArtifactStagingDirectory)/publish.zip'
    fileType: 'zip'
    onError: 'error'
    ignorePaths: |
      Logging.*
      Serilog.*

Example — Validate local test folder

steps:
- task: ValidateJsonConfig@1
  inputs:
    path: '$(Build.SourcesDirectory)/src/MyApp'
    fileType: 'json'
    jsonFileName: 'host.json'
    onError: 'warning'

Example — Validate alternate config file

steps:
- task: ValidateJsonConfig@1
  inputs:
    path: '$(Build.SourcesDirectory)/src/OtherApp'
    fileType: 'json'
    jsonFileName: 'settings.json'
    onError: 'error'

Inputs

Name Type Default Required Description
path string . ✔️ Path to zip (when fileType=zip) or folder root (when fileType=json)
jsonFileName string appsettings.json ❌ File name to locate inside zip or folder
fileType pickList zip ✔️ zip or json
onError pickList error ✔️ How to handle missing variables: error (fail) or warning (succeed with issues)
ignorePaths multiLine none ❌ Glob patterns of keys to skip (one per line, supports wildcards)

Output

The task logs any missing variables like this:

##[error]Parameter 'Services.Default' is declared in 'appsettings.json' but couldn't find any suitable variable substitution
##[warning]Parameter 'Test.FeatureX' is declared in 'appsettings.json' but couldn't find any suitable variable substitution
  • If no missing variables → task succeeds
  • If missing variables (onError=warning) → task succeeds with issues
  • If missing variables (onError=error) → task fails

FAQ

❓ Why aren’t array elements validated?

It wasn't part of the original scope of this project, I might add the feature in the future if I see some interest.

❓ What about parent vs child keys?

If an environment variable exists for a parent key, validation of its child keys is skipped. Example: if Host.Settings exists, then Host.Settings.Region will not be flagged as missing.

❓ How are variable names mapped in Azure DevOps?

Library variables with dots (.) are automatically converted to underscores (_). Example: App.Name → App_Name → matches App.Name in JSON.


Author

Developed and maintained by Vikansys AB (Sweden).
For issues or feature requests, please reach out via email.


License

Licensed under the MIT License.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft