Questions tagged [policy-based-management]

For questions about SQL Server Policy Based Management

16 questions
11
votes
1 answer

Issue with Table Naming Conventions and Policy Management in SQL Server 2016

In SQL Server 2012, I had a policy set to not allow spaces in a table name. However, when I use the same policy in SQL Server 2016, I get an error. Here is the code for the condition: DECLARE @condition_id INT EXEC…
5
votes
1 answer

Prevent users creating constraints or indexes with no name

I have done some searching but haven't found a solution to my problem. I started with some databases where users didn't care to name PK constraints, foreign keys or indexes, ending up with system generated names like PK__CarRenta__3213E83F2E5BD364.…
Martin Guth
  • 715
  • 1
  • 8
  • 22
3
votes
1 answer

postgresql - Policy to prevent a field from being updated

How can I create a policy to prevent a field from being updated? I am thinking something like this: CREATE POLICY "test" ON posts.created_at FOR UPDATE WITH CHECK (exists(created_at)); Obviously this does not work, but I would like a way for this…
2
votes
2 answers

Is it best practice to revoke server permissions to the server "public" role on SQL Server instances?

We have evaluated the Microsoft "best practice" policies (located at C:\Program Files (x86)\Microsoft SQL Server\number\Tools\Policies\DatabaseEngine\1033) on each of our SQL Server instances (example here). The following issue has been flagged up…
2
votes
1 answer

Enforce conditions on queries

Currently I have a simple schema, a sites table and an items table. Sites own many items, items has a siteId column to store the reference of the site which owns it. I'd like to be able to enforce a condition when querying items, meaning returning…
Ben
  • 179
  • 1
  • 8
1
vote
1 answer

How to write (postgres) RLS-policies for related/nested tables?

I have a database structure with lots of tables related to eachother. For the sake of this question let's simplify it a bit to a project-management idea: Organizations have Departments, Departments have Projects and Projects have Tasks. And then…
1
vote
1 answer

Postgres/Postgis : setting up rls policies

So i'm trying to configure the different accesses for mutliple users to my postgres/postgis database. Basically I have 1 manager user and 4 weak users accessing the db. What I would like to do is to prevent a weak user to be able to delete entries…
tonyduky
  • 111
  • 2
1
vote
0 answers

Issue with table naming policy with PBM - can't create it passed in the condition or not

I used PBM to create a condition to blocking create tables if nomenclature no haven't the prefix tbl: EXEC msdb.dbo.sp_syspolicy_update_condition @condition_id=24, @description=N'Necessário acrescentar o prefixo ''tbl''',…
1
vote
1 answer

Using Policy-Based Management to check backup history for an Availability Group database

I like using Policy-Based Management to do some simple "everything's okay" sanity checks and email me if something goes out of spec. Typically, I validate the time since the last full backup, both to verify backups are running on schedule, and also…
db2
  • 9,708
  • 4
  • 37
  • 58
1
vote
1 answer

How to select only one database in a policy in SQL Server?

I am creating a new policy which shows sproc creation dates. I am based on Stored Procedure facet and appropriate condition is created. Now I want this policy to include only one database in an instance When I select new policy from the dropdown…
igelr
  • 2,162
  • 3
  • 26
  • 56
1
vote
0 answers

User-defined Policy Evaluates to True when Evaluated but False when Invoked by Test-SqlAvailabilityReplica

I created a PBM condition and policy in SSMS. The policy runs a T-SQL script using the ExecuteSql function against the Server facet to determine whether all databases that are expected to be a member of an availability group are in fact members of…
0
votes
1 answer

Run Policy Based Management On Central Management Server with Code

I have a jump\terminal server to administer 100 SQL Servers and want to evaluate my locally created policies across all the servers by using the Central Management Server but WITHOUT: creating the policies on the target servers and using the…
0
votes
1 answer

Apply policy management column name in SQL Server

I want to apply a specific rule when somebody create new column in SQL Server 2016 Enterprise. For example: NR_NameColumn = int IS_Deleted = bit DT_update = Date ID_User = int and etc... How can I apply it?
LB_
  • 3
  • 1
  • 3
0
votes
1 answer

Using whole row in Row Level Security policy

I am using row level security with function, for example CREATE POLICY person_select_policy ON core.person FOR SELECT USING (core.person_policy_check(id, 'read') = TRUE); Is it possible to pass whole row to the function? So the function would have…
0
votes
1 answer

SQL Service Account group policy permissions

I'm trying to establish the best practice standards for configuring service account permissions in Group Policy. Based on Microsoft documentation, SQL Server setup requests permissions for the per-service SIDs or local Windows groups used by SQL…
1
2