Policy objects specify the conditions you wish to enforce against database targets using the Distributed Management Framework (DMF). In this tutorial, we create a DMF policy that enforces the stored procedure naming convention condition we created together in the previous step.
Difficulty: Average
Time Required: 15 minutes
Here's How:
- Open SQL Server Management Studio (SSMS) and expand the Management folder.
- Expand the Policy folder underneath the Management folder.
- Right-click on the Policies folder and select New Policy from the pop-up menu.
- Provide a name for your policy by typing it into the Name text box.
- Choose the condition you want to enforce from the drop-down menu. If you haven't already created a condition, read creating DMF conditions.
- Choose the evaluation mode you wish to use from the drop-down menu. On Demand mode does not perform any automated policy enforcement and allows you to run the policy at your discretion. On Schedule mode allows you to create a schedule for policy execution. On Change - Log Only mode creates a log entry whenever the database changes in a manner that violates the policy. On Change - Prevent mode verifies that all changes to the database comply with the policy before permitting the change.
- Click the OK button to create the policy.
Tips:
- If you use DMF policies, be sure to back up the msdb database, as SQL Server stores them there.
What You Need
- SQL Server 2008 or later
- SQL Server Management Studio


