Comments (6)
I have a couple thoughts on resolving the mapped user issue:
- Throw a warning and continue if a mapped login is detected (like the other checks)
- Add a -Force switch. If -Force is declared, it will drop the user from the database and then set the owner. Otherwise it will throw a warning.
Thoughts?
from dbatools.
Agree with the first one.
For the second one, why drop the user and not only set him as dbowner ?
Imagine someone set 'user1' (that have datareader permissions) as dbowner
but he was wrong and have to set 'user2' as dbowner, now, the user 'user1'
do not have the permissions (has lost datareader) he had before.
This makes sense to you?
No dia domingo, 21 de agosto de 2016, MikeFal [email protected]
escreveu:
I have a couple thoughts on resolving this:
- Throw a warning and continue if a mapped login is detected (like the
other checks)- Add a -Force switch. If -Force is declared, it will drop the user
from the database and then set the owner. Otherwise it will throw a warning.Thoughts?
β
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#156 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ASnfI98O4NMTLmddc-9uYZClY5uuac8Tks5qiHjHgaJpZM4JnazA
.
Cumprimentos,
ClΓ‘udio Silva
e-mail: [email protected]
linkedin: https://pt.linkedin.com/in/claudioessilva
twitter: http://www.twitter.com/claudioessilva
from dbatools.
You can't set a login as database owner if it exists as a user in the database. Adding it to the db_owner role is not the same as setting the database owner to a login. That's why we'd have to drop the user. I agree with your concerns that if the user gets dropped, you lose any permissions the user had. This is why they would need to use -Force to perform the user drop.
Powershell is a sharp knife. Be careful you don't cut yourself with it. ;)
Of course, I'm open to not doing this and simply throwing a warning if the user is in the database.
from dbatools.
That's true @MikeFal! I had forgotten this one!
That said I agree with the second one too π
from dbatools.
Additionally, it's not possible for AD groups to be database owners is it? I think we came across this in the DbaJobOwner cmdlets as well but it was fixed there, might need a check for that too.
from dbatools.
@MikeFal would you be happy for me to attempt to fix the issue I had with AD groups as database owners in Set-DbaDatabaseOwner? I think it was fixed in the "JobOwner" cmdlets you wrote, but not here, so I can probably just fix it with code copied or inspired from what you've written elsewhere.
from dbatools.
Related Issues (20)
- Versions of included sqlserver DLLs both newer and older than sqlserver module.
- Get-DbaDatabase significantly slower on SQL2022 vs. SQL2016 when executing user is sysadmin HOT 26
- Error copying sql permissions with Copy-DbaLogin when the database user and server user does not match. HOT 4
- Disconnect-DbaInstance does not actually disconnect HOT 2
- Install-DbaInstance Feature MachineLearning(SQL_INST_MR) is not supported on SQL2022 HOT 1
- Copy-DbaDbTableData - Error when attempting to copy tables with a column of datatype Geography
- Backup-DbaDbCertificate and Restore-DbaDbCertificate issue with certificate naming HOT 1
- Copy-DbaLogin / Get-DbaLogin - does not seem to work properly when using array called $sqllogins as input HOT 1
- Get-DbaBackupInformation is not reading values for "IsCopyOnly" attribute
- `Restore-DbaDatabase` - Add `WITH RESTART`
- Install-DbaDarlingData - Missing Procedures and old domain in documentation HOT 5
- Is there a dbatools command that helps you translate an offending thread in the OS to a spid? HOT 1
- Add-DbaRegServer: Settings "Encrypt Connection" and "Trust server certificate" not saved when using CMS
- `Add-DbaDbRoleMember` - Unable to Add Role HOT 4
- Invoke-DbaDbLogShipping error: [Backup-DbaDatabase] SQL Server cannot check if \\HOST\Share\some\url exists. You can try disabling this check with -IgnoreFileChecks HOT 1
- Restore-DbaDatabase fails when using server-SMO as SqlInstance HOT 3
- Test-DbaSpn returns nothing when one of multiple instances does not have tcp/ip enabled on Windows Server 2022
- Copy-DbaAgentJob and Copy-DbaAgentServer using -Force results in loss of links from alerts to jobs HOT 1
- Test-DbaLastBackup fails if backup was mirrored based on Get-DbaBackupHistory output AND transaction logs are included in the restore test
- Update-DbaInstance not installing latest security update for a CU
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dbatools.