SQL Server supports both users and user-defined database roles being members of a database role. The SqlDatabaseRole resource should be enhanced to add this support. Currently, the resource checks whether all Members, MembersToInclude, or MembersToExclude are valid Users on the database.
Instead of solely checking for a valid database User, the resource should also validate whether it matches a Role defined in the database.
SQL Server edition and version
Microsoft SQL Server 2017 (RTM) - 14.0.1000.169 (X64) Aug 22 2017 17:04:49 Copyright (C) 2017 Microsoft Corporation Enterprise Edition (64-bit) on Windows Server 2019 Datacenter 10.0 <X64> (Build 17763: ) (Hypervisor)
SQL Server PowerShell modules
SQLPS
SqlServer
SqlServerDsc
Operating system
OsName : Microsoft Windows Server 2019 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture : 64-bit
WindowsVersion : 1809
WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage : en-US
OsMuiLanguages : {en-US}
Problem description
SQL Server supports both users and user-defined database roles being members of a database role. The SqlDatabaseRole resource should be enhanced to add this support. Currently, the resource checks whether all Members, MembersToInclude, or MembersToExclude are valid Users on the database.
Verbose logs
DSC configuration
Suggested solution
Instead of solely checking for a valid database User, the resource should also validate whether it matches a Role defined in the database.
SQL Server edition and version
SQL Server PowerShell modules
Operating system
PowerShell version
SqlServerDsc version