Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SqlServerRole: Add support for nested roles #1452

Closed
nabrond opened this issue Dec 30, 2019 · 1 comment · Fixed by #1453
Closed

SqlServerRole: Add support for nested roles #1452

nabrond opened this issue Dec 30, 2019 · 1 comment · Fixed by #1453
Labels
enhancement The issue is an enhancement request.

Comments

@nabrond
Copy link
Contributor

nabrond commented Dec 30, 2019

Details of the scenario you tried and the problem that is occurring

SQL Server supports both logins and user-defined server roles being members of a server role. The SqlServerRole resource should be enhanced to add this support. Currently, the resource checks whether all Members, MembersToInclude, or MembersToExclude are valid Logins on the system.

Verbose logs showing the problem

N/A

Suggested solution to the issue

Instead of solely checking for a valid Login, the resource should also validate whether it matches a Role defined in the instance.

The DSC configuration that is used to reproduce the issue (as detailed as possible)

SqlServerRole 'Role-DBAdmins'
{
    Ensure = 'Present'
    ServerRoleName = 'DBAdmins'
    ServerName = 'sql.contoso.com'
    PsDscRunAsCredential = $SqlAdministratorCredential
}

SqlServerRole 'Role-sysadmin'
{
    Ensure = 'Present'
    ServerRoleName = 'sysadmin'
    ServerName = 'sql.constoso.com'
    MembersToInclude = 'DBAdmins'
    PsDscRunAsCredential = $SqlAdministratorCredential
}

SQL Server edition and version the target node is running

SQL 2012+

SQL Server PowerShell modules present on the target node

SQLPS
SqlServer
SqlServerDsc

The operating system the target node is running

N/A

Version and build of PowerShell the target node is running

N/A

Version of the DSC module that was used ('dev' if using current dev branch)

dev

@johlju johlju added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. labels Dec 31, 2019
@johlju
Copy link
Member

johlju commented Dec 31, 2019

Sounds like a good addition.

@johlju johlju added in progress The issue is being actively worked on by someone. and removed help wanted The issue is up for grabs for anyone in the community. labels Dec 31, 2019
@johlju johlju changed the title SqlServerRole: Add support for nested roles. SqlServerRole: Add support for nested roles Dec 31, 2019
johlju pushed a commit that referenced this issue Jan 12, 2020
… checks (#1453)

- SqlServerRole
  - Add support for nested role membership (issue #1452).
  - Removed use of case-sensitive Contains() function when evalutating role membership
    (issue #1153).
  - Refactored mocks and unit tests to increase performance (issue #979).
@johlju johlju removed the in progress The issue is being actively worked on by someone. label Jan 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants