Closed mattcargile closed 2 months ago
Let's have a look at other commands:
Add-LocalGroupMember -Group xyz -Member abc
So we can change the parameter name zu "Member" with an alias for compatibility.
I like that reference. Add-ADGroupMember
has a similar syntax. Should Add-DbaServerRoleMember
be changed? It would be nice to have -Members
added that accepted both roles and logins?
Just opened a pull request for that.
The pull request is now ready for review.
Verified issue does not already exist?
I have searched and found no existing issue
What error did you receive?
Steps to Reproduce
Please confirm that you are running the most recent version of dbatoolsc
Other details or mentions
One could update this section of code to check for
$db.Roles.Name
. https://github.com/dataplat/dbatools/blob/7af0e3aec6b9d621fa93af0e2ca5f1c621e7140c/public/Add-DbaDbRoleMember.ps1#L143Maybe there needs to be another parameter called
-DatabaseRole
much likeAdd-DbaServerRoleMember
? I guess that precedent overrides the simpler solution of accepting both$db.Roles
and$db.Users
for-User
. Adding the new parameter-DatabaseRole
might cause a breaking change or at least a confusing API.-DatabaseRole
should be the roles that are to be altered. Then-Role
and-User
would be the principals to be added. If we add-DatabaseRole
and it is not the role actually being altered then that is the reverse syntax toAdd-DbaServerRoleMember
. I think I would prefer the breaking change in the semantics of the parameters.I could also see
-Principal
being a parameter instead though none of the cmdlets use that language, I think.What PowerShell host was used when producing this error
PowerShell Core (pwsh.exe)
PowerShell Host Version
SQL Server Edition and Build number
.NET Framework Version
Workaround
Used T-SQL.