<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>SQL Server Policy-Based Management : Management Studio</title><link>http://blogs.msdn.com/sqlpbm/archive/tags/Management+Studio/default.aspx</link><description>Tags: Management Studio</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Policy Categories</title><link>http://blogs.msdn.com/sqlpbm/archive/2008/07/07/policy-categories.aspx</link><pubDate>Mon, 07 Jul 2008 22:06:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8703656</guid><dc:creator>sqlpbm</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/sqlpbm/comments/8703656.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sqlpbm/commentrss.aspx?PostID=8703656</wfw:commentRss><description>&lt;p&gt;Policy categories have two purposes in SQL2K8: 1) organization of policies and 2) policy scope. In this posting we'll explore creating categories for each of these purposes.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;font size="3"&gt;Creating Categories&lt;/font&gt;&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;There are two ways to create a category: 1) the &lt;font face="Courier"&gt;Manage Categories&lt;/font&gt; dialog and 2) The &lt;font face="Courier"&gt;Policy Properties&lt;/font&gt; dialog. &lt;/p&gt;  &lt;p&gt;To create a category from the Manage Categories dialog, connect Object Explorer to an instance of SQL2K8. Expand the &lt;font face="Courier"&gt;Management&lt;/font&gt; node, right-click on the &lt;font face="Courier"&gt;Policy Management&lt;/font&gt; and select &lt;font face="Courier"&gt;Manage Categories&lt;/font&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/Categories_E16A/ManageCategories.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="194" alt="ManageCategories" src="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/Categories_E16A/ManageCategories_thumb.png" width="244" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;This will launch the &lt;font face="Courier"&gt;Manage Categories&lt;/font&gt; dialog. On this dialog you can create, update, and delete categories and change the subscription state for each category. I'll cover the subscription state later on.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/Categories_E16A/ManageCategoriesDialog_1.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="287" alt="ManageCategoriesDialog" src="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/Categories_E16A/ManageCategoriesDialog_thumb_1.png" width="410" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;To create a new category click in the Name field on the last row and type in the name for the category. This will create a new category which is mandatory for every database. Click OK to dismiss the dialog and you're done.&lt;/p&gt;  &lt;p&gt;You can also create a new category from the &lt;font face="Courier"&gt;Policy Properties&lt;/font&gt; dialog. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/Categories_E16A/PolicyDialog.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="288" alt="PolicyDialog" src="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/Categories_E16A/PolicyDialog_thumb.png" width="336" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;On the &lt;font face="Courier"&gt;Description&lt;/font&gt; tab click &lt;font face="Courier"&gt;New&lt;/font&gt; next to the &lt;font face="Courier"&gt;Category &lt;/font&gt;field. This launches the new &lt;font face="Courier"&gt;Create new category&lt;/font&gt; which accepts a category name. The category will be created as mandatory for all databases. You also use this dialog to assign a policy to a particular category. Use the category combo box to select a category. &lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;font size="3"&gt;Organizing Policies&lt;/font&gt;&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;There are a few key places where the use of categories simplifies certain actions.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Object Explorer Details&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;When the &lt;font face="Courier"&gt;Policies&lt;/font&gt; folder is selected in Object Explorer, Object Explorer Details lists all of the policies on the system with a select set of properties, including Category.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/Categories_E16A/ObjectExplorerDetails.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="112" alt="ObjectExplorerDetails" src="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/Categories_E16A/ObjectExplorerDetails_thumb.png" width="336" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The columns in Object Explorer Details can be sorted, just click on the column heading you wish to sort by.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/Categories_E16A/ObjectExplorerDetailsSorted.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="106" alt="ObjectExplorerDetailsSorted" src="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/Categories_E16A/ObjectExplorerDetailsSorted_thumb.png" width="333" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Sorting on category can make it easier to perform certain operations.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/Categories_E16A/ObjectExplorerDetailsContextMenu.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="155" alt="ObjectExplorerDetailsContextMenu" src="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/Categories_E16A/ObjectExplorerDetailsContextMenu_thumb.png" width="244" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Evaluate, Export, and Script are all valid operations on a set of policies. You could use ctrl-click to select multiple disjointed policies but I've found sorting to be quicker and less error prone.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;View Policies Dialog&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;Right-click any object in Object Explorer and select Policies -&amp;gt; View to see the policies which apply (or can apply) to the selected object. The &lt;font face="Courier"&gt;View Policies&lt;/font&gt; dialog is displayed.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/Categories_E16A/ViewPoliciesDialog.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="290" alt="ViewPoliciesDialog" src="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/Categories_E16A/ViewPoliciesDialog_thumb.png" width="430" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Category is a property in the table which can be used to sort the policies. This makes it easy to see which policies in a particular category apply to the object or are in violation.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;Evaluate Policies&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;The &lt;font face="Courier"&gt;Evaluate Policies&lt;/font&gt; dialog allows you to manually evaluate one or more policies against a single object or against the computed target set (all objects the policies applies to). &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/Categories_E16A/EvaluatePolicies.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="314" alt="EvaluatePolicies" src="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/Categories_E16A/EvaluatePolicies_thumb.png" width="426" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;This dialog includes the Category property which you can sort on. If you wish to run all of the policies in a particular category sorting them first prevents you from having to hunt and peck for each policy in a particular category.&lt;/p&gt;  &lt;p&gt;In this section we looked at several places where using categories can expedite certain policy tasks. Now let's look at category subscriptions which controls the applicability of policies.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;font size="3"&gt;Delegation of Policy Applicability&lt;/font&gt;&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;Using categories databases can subscribe to certain sets of policies. Subscribe simply means that all of the policies in the category may apply or do not apply to the particular database. This is only applicable to policies which target databases or objects contained in a database. Policies which target the instance and instance objects (excluding database) are excluded from the subscription.&lt;/p&gt;  &lt;p&gt;Categories can be configured for mandatory subscription, meaning all databases must subscribe to the category and cannot opt out, and non-mandatory subscriptions, meaning individual databases can opt-in/opt-out of policies in the category.&lt;/p&gt;  &lt;p&gt;When a database subscribes to a category it's not implicit that all policies in the category apply to the database and all objects in the database. The policy may contain a target filter which eliminates certain objects from the scope of the policy. However, if a database does not subscribe to a category the database and all database objects in that databases are explicitly excluded from the scope of the policy.&lt;/p&gt;  &lt;p&gt;There are certain situations where optional categories make sense. A set of policies may only apply to certain databases but the Policy Administrator doesn't know which databases the policies apply to. However the owner of the database does know and can choose which policy categories apply and which don't.&lt;/p&gt;  &lt;p&gt;For example you may have a set of policies that only apply to reporting (read-only) databases, but only the database owner knows if their database is a reporting database (there is no database attribute to designate this type of database and therefore no way to construct a target filter). The Policy Administrator would create the policies for reporting databases in a category called &amp;quot;Reporting Database Policies&amp;quot;. The category is configured to be optional. Each database owner can then choose to subscribe to the category or not.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#800000"&gt;Security Notice: You must be SA or DBO of the database to control policy category subscriptions.&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/Categories_E16A/DatabaseCategories.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="251" alt="DatabaseCategories" src="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/Categories_E16A/DatabaseCategories_thumb.png" width="307" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This launches the &lt;font face="Courier"&gt;Categories&lt;/font&gt; dialog.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/Categories_E16A/CategoriesDialog_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="285" alt="CategoriesDialog" src="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/Categories_E16A/CategoriesDialog_thumb_2.png" width="431" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Mandatory categories appear subscribed to and disabled - meaning they cannot be unsubscribed from. The &amp;quot;&amp;lt;Default&amp;gt;&amp;quot; category is always mandatory. Non-mandatory categories have the subscription checkbox enabled to allow the database owner to subscribe/unsubscribe as appropriate. When the category is expanded the list of policies in the category is displayed. To subscribe to the category select the checkbox under the Subscribed column and click OK.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;font size="3"&gt;Summary&lt;/font&gt;&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;Categories serve two purposes: 1) organization (group like policies together) and 2) policy scope. It's a best practice to categorize your policies by their purpose (such as industry compliance or security). Choosing to mark the categories as optional or mandatory depends on your particular situation.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#008040"&gt;Suggestion: If you have SQL2K and/or SQL2K5 servers in your topology and you want to create policies for these servers you can create policies on a SQL2K8 server. Create two non-mandatory categories, &amp;quot;SQL Server 2000&amp;quot; and &amp;quot;SQL Server 2005&amp;quot; and place each policy in the appropriate category. This will make it easier to track what the policies are for. If you automate the policies using PowerShell you can easily select the correct set of policies for each server version.&lt;/font&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;_____________&lt;/p&gt;  &lt;p&gt;&lt;font size="1"&gt;About the Author:      &lt;br /&gt;Dan Jones is a PM on the SQL Server Manageability team at Microsoft.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8703656" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sqlpbm/archive/tags/Policy/default.aspx">Policy</category><category domain="http://blogs.msdn.com/sqlpbm/archive/tags/Management+Studio/default.aspx">Management Studio</category><category domain="http://blogs.msdn.com/sqlpbm/archive/tags/SQL+Server+2008/default.aspx">SQL Server 2008</category></item><item><title>Using PBM Against SQL2K and SQL2K5</title><link>http://blogs.msdn.com/sqlpbm/archive/2008/07/04/using-pbm-against-sql2k-and-sql2k5.aspx</link><pubDate>Fri, 04 Jul 2008 22:32:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8690816</guid><dc:creator>sqlpbm</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/sqlpbm/comments/8690816.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sqlpbm/commentrss.aspx?PostID=8690816</wfw:commentRss><description>&lt;p&gt;We get this question a lot: can I use PBM against a SQL2K &amp;amp; SQL2K5 instances. The quick answer is yes but in a limited fashion. PBM is ultimately based on SMO (SQL Server Management Objects) and SMO supports SQL2K, SQL2K5, and SQL2K8. PBM relies on some changes to the DB engine which are not available in versions below SQL2K8, therefore, not all PBM functionality&amp;#160; is available in SQL2K and SQL2K5.&lt;/p&gt;  &lt;p&gt;Let's divide the PBM functionality into four key areas:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Authoring policies &lt;/li&gt;    &lt;li&gt;Storing policies on a server &lt;/li&gt;    &lt;li&gt;Automated policy evaluation &lt;/li&gt;    &lt;li&gt;Manual policy evaluation &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;u&gt;&lt;font size="3"&gt;Authoring Policies&lt;/font&gt;&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;There are two ways to author a policy: connected and disconnect. Connected policy authoring is only supported in SQL2K8. When authoring in connected mode (Object Explorer is connected to an instance) the policy is stored on the server. There is no way to alternatively save the policy to the file system (other than exporting it after it's created on the server). Disconnected authoring saves the policy to the file system (as an XML file). This functionality is only available in SQL2K8 Management Studio. Since it doesn't require a connection to a back-end server you don't need an instance of SQL2K8 available. Therefore, authoring policies is somewhat dependent upon SQL2K8 - you need the toolset but not a server.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;font size="3"&gt;Storing Policies On A Server&lt;/font&gt;&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;There are two ways to store a policy on a server: create it on the server and import a policy XML file to the server. Both of these are only available on SQL2K8 servers.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;font size="3"&gt;Automated Policy Evaluation&lt;/font&gt;&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;Policy automation is dependent upon enhancements to dependent features only available in SQL2K8 (SQCLR, SMO, Agent and DDL Eventing.) Therefore, automated policy evaluation (Check on Change - Prevent, Check on Change - Log, and Check on Schedule) is only available on SQL2K8 servers. In addition, the automation requires the policy to stored locally on the server which is only supported on SQL2K8.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;font size="3"&gt;Manual Policy Evaluation&lt;/font&gt;&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;Manually evaluating a policy is a client-side operation (simply meaning it doesn't run in the context of the DB Engine service) and therefore it requires SQL2K8 Management Studio (or at least the SQL2K8 management stack - PBM &amp;amp; SMO APIs). There are four ways to manually evaluate a policy:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;From Object Explorer in Management Studio &lt;/li&gt;    &lt;li&gt;From Registered Servers in Management Studio &lt;/li&gt;    &lt;li&gt;The PowerShell cmdlet Invoke-PolicyEvaluation &lt;/li&gt;    &lt;li&gt;From the PBM API &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Object Explorer (OE): Policy evaluation is supported from OE when connected to SQL2K5 and SQL2K8 servers (note: this may also be available when connected to a SQL2K server but I didn't have one available to me at the time of this writing to verify). You get the same Evaluation dialog in both cases. However, when connected to a SQL2K5 server there are no locally stored policies which means you need to select policies from file or from a SQL2K8 server.&lt;/p&gt;  &lt;p&gt;Registered Servers (RegSrvrs): Policy evaluation is supported from RegSrvrs for SQL2K, SQL2K5, and SQL2K8 servers. You can evaluate policies that are saved to file or stored on a SQL2K8 server. You can also evaluate policies against a group of servers. The server group can contain mixed versions.&lt;/p&gt;  &lt;p&gt;Invoke-PolicyEvaluation: This PowerShell cmdlet can be run against SQL2K, SQL2K5, and SQL2K8 servers. You just pass in the server name to the TargetServerName parameter. You can evaluate policies stored on a SQL2K8 server or on the file system. This &lt;a href="http://blogs.msdn.com/sqlpbm/archive/2008/06/14/running-against-sql-server-2005-and-sql-server-2000.aspx" target="_blank"&gt;blog post&lt;/a&gt; shows how to use the Agent PowerShell subsystem in SQL2K8 to create a job that runs a PowerShell script to evaluate policies against a group of servers. These servers can be SQL2K, SQL2K5 and SQL2K8 servers. &lt;/p&gt;  &lt;p&gt;PBM API: The PBM API is a public API and contains methods for evaluating policies. This is exactly what we use under the covers for our policy evaluation. You can create your own .Net application which calls this API. Similar to the PowerShell cmdlet you need to pass in a connection to the server to evaluate. This connection can be a SQL2K, SQL2K5, or SQL2K8 connection. The details for how to do this (the code you need to write) is beyond the scope of this posting but is a good topic for a future posting.&lt;/p&gt;  &lt;p&gt;&lt;u&gt;&lt;font size="3"&gt;Summary&lt;/font&gt;&lt;/u&gt;&lt;/p&gt;  &lt;p&gt;When we designed PBM we accounted for the fact that not all customers immediately upgrade their environment - you have to deal with mixed environments. We wanted to be sure PBM would add value to these mixed environments but we also need to give you a reason to upgrade :-). Therefore, we enable you to run policies against SQL2K and SQL2K5 just not with the same fidelity as SQL2K8.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8690816" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sqlpbm/archive/tags/Policy/default.aspx">Policy</category><category domain="http://blogs.msdn.com/sqlpbm/archive/tags/PowerShell/default.aspx">PowerShell</category><category domain="http://blogs.msdn.com/sqlpbm/archive/tags/Management+Studio/default.aspx">Management Studio</category><category domain="http://blogs.msdn.com/sqlpbm/archive/tags/SQL+Server+Agent/default.aspx">SQL Server Agent</category><category domain="http://blogs.msdn.com/sqlpbm/archive/tags/SQL+Server+2000/default.aspx">SQL Server 2000</category><category domain="http://blogs.msdn.com/sqlpbm/archive/tags/SQL+Server+2005/default.aspx">SQL Server 2005</category><category domain="http://blogs.msdn.com/sqlpbm/archive/tags/SQL+Server+2008/default.aspx">SQL Server 2008</category></item><item><title>Creating A Policy With the GUI</title><link>http://blogs.msdn.com/sqlpbm/archive/2008/04/26/creating-a-policy-with-the-gui.aspx</link><pubDate>Sun, 27 Apr 2008 04:44:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8429813</guid><dc:creator>sqlpbm</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/sqlpbm/comments/8429813.aspx</comments><wfw:commentRss>http://blogs.msdn.com/sqlpbm/commentrss.aspx?PostID=8429813</wfw:commentRss><description>&lt;p&gt;In the &lt;a href="http://blogs.msdn.com/sqlpbm/archive/2008/04/20/policy-based-management-overview.aspx" target="_blank"&gt;previous posting&lt;/a&gt; we introduced the main PBM concepts through the use of a sample policy: All stored procedures in the database must start with &amp;quot;usp_&amp;quot;. In this posting we will walk through the creation of that policy using the PBM GUI accessible from SQL Server Management Studio (SSMS).&lt;/p&gt;  &lt;p&gt;The first step in creating the policy is to create a condition. To do this we use Object Explorer to navigate to the Policy Management node.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/CreatingAPolicyWiththeGUI_7122/OE_PolicyMgmt_Node_01.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="226" alt="OE_PolicyMgmt_Node_01" src="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/CreatingAPolicyWiththeGUI_7122/OE_PolicyMgmt_Node_01_thumb.png" width="222" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Right-clicking on the &lt;em&gt;Conditions&lt;/em&gt; folder we select &lt;em&gt;New Condition...&lt;/em&gt; which launches the New Condition dialog. &lt;a href="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/CreatingAPolicyWiththeGUI_7122/Condition_01.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="320" alt="Condition_01" src="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/CreatingAPolicyWiththeGUI_7122/Condition_01_thumb.png" width="439" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;First we give our Condition a name. Conditions can be reused by multiple policies so we want to give it a meaningful name. Since conditions define the desired state of the system we'll give it a name in the positive. Something like &lt;em&gt;SP Name Prefix usp_&lt;/em&gt; should do. Next we have to pick which facet we want to build our expression over. Remember, facets define two things for us: target types and properties. We have a choice of three facets: Stored Procedure, Multi-Part Name, and Name. For this example we'll pick the Multi-Part Name facet.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/CreatingAPolicyWiththeGUI_7122/Condition_02_1.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="321" alt="Condition_02" src="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/CreatingAPolicyWiththeGUI_7122/Condition_02_thumb_1.png" width="441" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Now that we have our condition created we right-click on the Policies node in OE and select &lt;em&gt;New Policy... &lt;/em&gt;We give our policy a name and select the condition we created above. We also could have started from the New Policy dialog and launched into the New Condition dialog.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/CreatingAPolicyWiththeGUI_7122/NewPolicy_01.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="324" alt="NewPolicy_01" src="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/CreatingAPolicyWiththeGUI_7122/NewPolicy_01_thumb.png" width="444" border="0" /&gt;&lt;/a&gt;&amp;#160; &lt;/p&gt;  &lt;p&gt;We want to ensure no stored procedures are created on the system which violate the policy, therefore, we choose the &lt;em&gt;On change: prevent&lt;/em&gt; evaluation mode. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/CreatingAPolicyWiththeGUI_7122/NewPolicy_02.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="326" alt="NewPolicy_02" src="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/CreatingAPolicyWiththeGUI_7122/NewPolicy_02_thumb.png" width="445" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Next we need to choose which targets the policies applies to. Because we built our condition on the multi-part name facet we see all of the targets which support that facet. We select &lt;em&gt;Stored Procedure&lt;/em&gt; since that's the only one we care about for this example.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/CreatingAPolicyWiththeGUI_7122/NewPolicy_04.png"&gt;&lt;/a&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/CreatingAPolicyWiththeGUI_7122/NewPolicy_03.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="325" alt="NewPolicy_03" src="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/CreatingAPolicyWiththeGUI_7122/NewPolicy_03_thumb.png" width="446" border="0" /&gt;&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;On the &lt;em&gt;Description&lt;/em&gt; tab we can enter a description for the policy and a link (http, https, and mailto) for where to go for additional help. &lt;a href="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/CreatingAPolicyWiththeGUI_7122/NewPolicy_04.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="328" alt="NewPolicy_04" src="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/CreatingAPolicyWiththeGUI_7122/NewPolicy_04_thumb.png" width="445" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;After we enter this information click &lt;em&gt;OK&lt;/em&gt; to save the policy. The policy and condition show up in Object Explorer.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/CreatingAPolicyWiththeGUI_7122/OE_PolicyMgmt_Node_02.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="82" alt="OE_PolicyMgmt_Node_02" src="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/CreatingAPolicyWiththeGUI_7122/OE_PolicyMgmt_Node_02_thumb.png" width="240" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Now we can attempt to create a stored procedure which violates our policy. In this example we create a nonsensical SP but the important point is the name, &lt;em&gt;MyProcedure&lt;/em&gt;. Since our policy states names must start with 'usp_' our procedure should not be created.&lt;a href="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/CreatingAPolicyWiththeGUI_7122/PolicyViolation_1.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="231" alt="PolicyViolation" src="http://blogs.msdn.com/blogfiles/sqlpbm/WindowsLiveWriter/CreatingAPolicyWiththeGUI_7122/PolicyViolation_thumb_1.png" width="676" border="0" /&gt;&lt;/a&gt; And that's exactly what happens. Let's take a closer look at the information we get back. First, the message tells us which policy we violated along with which object violated the policy. We also see the condition, policy description, and the link for additional help. All of this is useful information if the person is not familiar with the policy. The statement which violated the policy is included in the output. If this was a long SQL script this can help us trouble shoot the offending code.&lt;/p&gt;  &lt;p&gt;This simple example showed you everything you need to get started using Policy-Based Management. Though our condition was straightforward they can get quite complex. In future postings we'll explore building more complex conditions in addition to some of the other advanced capabilities of Policy-Based Management.&lt;/p&gt;  &lt;p&gt;_____________&lt;/p&gt;  &lt;p&gt;&lt;font size="1"&gt;About the Author:      &lt;br /&gt;Dan Jones is a PM on the SQL Server Manageability team at Microsoft.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8429813" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/sqlpbm/archive/tags/Conditon/default.aspx">Conditon</category><category domain="http://blogs.msdn.com/sqlpbm/archive/tags/Policy/default.aspx">Policy</category><category domain="http://blogs.msdn.com/sqlpbm/archive/tags/Management+Studio/default.aspx">Management Studio</category><category domain="http://blogs.msdn.com/sqlpbm/archive/tags/Sample/default.aspx">Sample</category></item></channel></rss>