A solution for enforcing policies against Microsoft Dataverse data and operations. This repository provides core validation and enforcement logic with a client surface and a planned Custom API bridge to integrate with host applications.
Status: WIP — Core functionality is available; the CustomApi project is planned as the bridge between the client and core but hasn't been implemented yet.
Contents
src/DataversePolicyEnforcement.Core— Core libraries implementing validation, policy rules, and enforcement logic.src/DataversePolicyEnforcement.Client— Client(s) that call into the core libraries to apply policies from a UI or automated process.src/DataversePolicyEnforcement.CustomApi— (Planned) A Dataverse Custom API project that will act as the bridge between Dataverse clients and theCorelogic.tests/— Unit and integration tests for the core and client projects.
Key concepts
- Policy: A rule or set of rules describing allowed or disallowed operations on Dataverse entities (create/update/delete) or attribute values.
- Enforcement: The runtime logic that evaluates operations against policies and returns accept/deny responses or corrective actions.
- Custom API bridge: A Dataverse-hosted endpoint that receives requests from the Dataverse runtime (or external clients) and routes them to the
Corefor evaluation.
Prerequisites
- Git
- .NET SDK 6.0 or newer (adjust to your target framework if different)
- (Optional) Visual Studio 2022 / VS Code for development
Getting started
-
Clone the repository
git clone https://github.com/blakeZTL/DataversePolicyEnforcement.git -
Open the solution
- From Visual Studio: open the solution file in
src/(if present). - From the command line:
dotnet restorein the solution root.
- From Visual Studio: open the solution file in
-
Build
dotnet build -
Run tests
dotnet test
Project guidance
-
Core
- Location:
src/DataversePolicyEnforcement.Core - Responsibilities: define policy models, evaluation engine, utilities for loading and applying policies.
- Should be framework-agnostic so it can be reused by different hosts (Custom API, background services, CLI, etc.).
- Location:
-
Client
- Location:
src/DataversePolicyEnforcement.Client - Responsibilities: provide a consuming surface (console, service, or UI) that calls into
Coreto validate operations.
- Location:
-
Custom API (planned)
- Location:
src/DataversePolicyEnforcement.CustomApi(planned) - Responsibilities: host a Dataverse Custom API that receives requests from Dataverse workflows/plugins or direct clients, forwards them to
Corefor evaluation, and returns results. - Note: This project has not been built yet. Recommended approach: implement a lightweight Web API using the same .NET target as
Core, keep request/response models minimal, and perform authorization and validation before delegating toCore.
- Location:
Development notes
- Keep
Corefree of Dataverse-hosting dependencies so it remains reusable. - Add comprehensive unit tests for each policy and enforcement path.
- Use dependency injection for pluggable components (policy stores, logging, telemetry).
Roadmap / TODO
- Implement
CustomApiproject to act as the bridge between Dataverse andCore. - Create sample Dataverse plugin or Power Automate connector that calls the Custom API.
- Add more policy examples and test coverage.
Contributing
- Fork the repo and open a pull request against
main. - Follow existing code style and add tests for new behavior.
Contact
- Repo:
https://github.com/blakeZTL/DataversePolicyEnforcement