{"id":74203,"date":"2017-10-09T03:28:41","date_gmt":"2017-10-09T03:28:41","guid":{"rendered":"https:\/\/www.red-gate.com\/simple-talk\/?p=74203"},"modified":"2021-08-24T13:39:22","modified_gmt":"2021-08-24T13:39:22","slug":"easy-way-create-policies","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/blogs\/easy-way-create-policies\/","title":{"rendered":"Easy way to create policies using SSMS"},"content":{"rendered":"<p><strong>SSMS<\/strong> has an interesting feature that turns easy the creation of policies to check our servers compliance.<\/p>\n<p>Right-clicking an item inside object explorer window, you will find <em>&#8216;Facet&#8217;<\/em> item in the context menu. Clicking on it will open the <em>&#8216;View Facets&#8217;<\/em> window.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-74204\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2017\/10\/facet01.png\" alt=\"facet context menu\" width=\"476\" height=\"389\" \/><\/p>\n<p>In the <em>&#8216;View Facets&#8217;<\/em> window, you can see all the facets related to the object you right-clicked. For example, the database object has a total of 5 facets.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-74205\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2017\/10\/facet02.png\" alt=\"database facets\" width=\"376\" height=\"119\" \/><\/p>\n<h3>Creating a new policy<\/h3>\n<p>Let&#8217;s use this feature to create a new policy:<\/p>\n<ul>\n<li>Click the <em>&#8216;Facet&#8217;<\/em> dropdown list in the <em>&#8216;View Facets&#8217;<\/em> window and select <em>&#8216;Database Performance&#8217;<\/em>. You may notice all the properties of the facet <em>&#8216;Database Performance&#8217;<\/em> inside <em>&#8216;Facet Properties&#8217;<\/em> area.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-74209\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2017\/10\/facet03-1.png\" alt=\"database facet\" width=\"742\" height=\"325\" \/><\/p>\n<ul>\n<li>Click the button <em>&#8216;Export Current State as Policy&#8217;<\/em><\/li>\n<li>Inside the <em>&#8216;Export as Policy&#8217;<\/em> window, type <em>&#8216;dbPerformancePolicy&#8217;<\/em> in the <em>&#8216;Policy Definition Name&#8217;<\/em> textbox<\/li>\n<li>Type <em>&#8216;dbPerformanceCondition&#8217;<\/em> in the <em>&#8216;Condition Name&#8217;<\/em> textbox<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-74207 size-full\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2017\/10\/facet04.png\" alt=\"export policies\" width=\"757\" height=\"341\" \/><\/p>\n<ul>\n<li>Inside <em>&#8216;Export as Policy&#8217;<\/em> window, click <em>&#8216;Ok&#8217;<\/em> button<\/li>\n<li>In the\u00a0<em>&#8216;View Facets&#8217;<\/em> window, click<em> &#8216;Ok&#8217;<\/em> button<\/li>\n<li>Inside <em>&#8216;Object Explorer&#8217;<\/em> window, expand <em>&#8216;Management&#8217;<\/em>-&gt;<em>&#8216;Policy Management&#8217;<\/em>-&gt;<em>&#8216;Policies&#8217;<\/em> and also <em>&#8216;Conditions&#8217;<\/em>. You may notice the new policy and condition.<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-74208 size-full\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2017\/10\/facet05.png\" alt=\"SSMS Policies\" width=\"301\" height=\"272\" \/><\/p>\n<ul>\n<li>Double click the <em>&#8216;dbPerformanceCondition&#8217;<\/em> object. You may notice several expressions in the condition.<\/li>\n<li>Inside <em>&#8216;Open Condition&#8217;<\/em> window, select the expressions from the 3rd to the last one and press <em>&#8216;Delete&#8217;<\/em> key<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-74210\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2017\/10\/facet06.png\" alt=\"policy conditions\" width=\"1129\" height=\"758\" \/><\/li>\n<li>Click &#8216;Ok&#8217; button inside <em>&#8216;Open Condition&#8217;<\/em> window<\/li>\n<\/ul>\n<p>As a result, you have a new policy to check the compliance of your databases.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SSMS has an interesting feature that turns easy the creation of policies to check our servers compliance. Right-clicking an item inside object explorer window, you will find &#8216;Facet&#8217; item in the context menu. Clicking on it will open the &#8216;View Facets&#8217; window. In the &#8216;View Facets&#8217; window, you can see all the facets related to&#8230;&hellip;<\/p>\n","protected":false},"author":50808,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2,143527],"tags":[],"coauthors":[],"class_list":["post-74203","post","type-post","status-publish","format-standard","hentry","category-blogs","category-database-administration-sql-server"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/74203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/50808"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=74203"}],"version-history":[{"count":1,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/74203\/revisions"}],"predecessor-version":[{"id":74211,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/74203\/revisions\/74211"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=74203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=74203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=74203"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=74203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}