Azure / azure-policy

Repository for Azure Resource Policy built-in definitions and samples
MIT License
1.51k stars 1.09k forks source link

[azure-policy-vscode-extension][Feature Request]: Add Policy JSON Schema Validation as Part of the Extension #1363

Open asilverman opened 3 months ago

asilverman commented 3 months ago

Summary

I would like to request the addition of JSON Schema validation for Azure Policy definitions and initiatives within the Azure Policy VSCode extension. This feature would provide real-time validation and feedback on policy files, enhancing the developer experience and ensuring adherence to schema standards.

Problem Statement

Currently, the Azure Policy VSCode extension does not include JSON Schema validation for policy files. As a result, developers have to rely on external tools or manual validation to ensure their policy files adhere to the correct format and standards. This can lead to errors, inconsistencies, and inefficiencies in policy development.

Proposed Solution

Integrate JSON Schema validation into the Azure Policy VSCode extension can be easily introduced via VSCode Extension Contribution Points , see more here: Mapping a schema in an extension

Probably a good idea is to introduce an optional suffix for azure policy like *.azpolicy.json so that its easier to apply the schema on this kind of file and have this documented.

If such a feature is implemented, it would be useful to:

  1. Validate Policy Definitions and Initiatives:

    • Automatically validate policy JSON files against predefined schemas.
    • Highlight errors and inconsistencies in real-time as developers write or modify policy files.
  2. Provide Feedback and Suggestions:

    • Offer suggestions for correcting validation errors.
    • Display informative messages to guide developers in adhering to best practices.
  3. Improve Developer Workflow:

    • Seamlessly integrate with VSCode's existing JSON validation features.
    • Reduce the need for external validation tools and streamline the policy development process.

Benefits

Additional Considerations

Alternatives

Conclusion

Adding JSON Schema validation to the Azure Policy VSCode extension would significantly enhance the tool's functionality and provide developers with valuable assistance in creating and maintaining Azure Policies. This feature would ensure policy files are accurate, consistent, and adhere to best practices, ultimately benefiting the broader Azure development community.


Thank you for considering this feature request. Please let me know if you need any additional information or clarification.