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


Limitations


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

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.NameApp_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.