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

SqlDatabaseRole: Conflict when assigning two roles to the same user #1252

Closed
ChristophHannappel opened this issue Nov 12, 2018 · 4 comments · Fixed by #1367
Closed

SqlDatabaseRole: Conflict when assigning two roles to the same user #1252

ChristophHannappel opened this issue Nov 12, 2018 · 4 comments · Fixed by #1367
Labels
by design The issue is describing an expect behavior. needs more information The issue needs more information from the author or the community. stale The issue or pull request was marked as stale because there hasn't been activity from the community.

Comments

@ChristophHannappel
Copy link

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

Trying to assign a user two database roles on the same database.

Verbose logs showing the problem

Test-ConflictingResources : A conflict was detected between resources '[SqlDatabaseRole]SP-ConfigDB-db_owner-FarmAccount
(E:\DSC\Configuration\SP2016-Configuration.ps1::289::13::SqlDatabaseRole)' and
'[SqlDatabaseRole]SP-ConfigDB-WSS_Content_Application_Pools-FarmAccount
(E:\DSC\Configuration\SP2016-Configuration.ps1::301::13::SqlDatabaseRole)' in node 'NodeName'. Resources have
identical key properties but there are differences in the following non-key properties: 'Role'. Values 'db_owner' don't match
values 'WSS_Content_Application_Pools'. Please update these property values so that they are identical in both cases.
At line:289 char:9

  •     Test-ConflictingResources $keywordName $canonicalizedValue $k ...
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidOperation: (:) [Write-Error], InvalidOperationException
    • FullyQualifiedErrorId : ConflictingDuplicateResource,Test-ConflictingResources

Suggested solution to the issue

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

SqlDatabaseRole SP-ConfigDB-db_owner-FarmAccount
            {
                Name = $SPFarmAccount.Username.toString()
                ServerName = $SPServiceDatabaseServerAlias
                InstanceName = 'MSSQLSERVER'
                Database = ($ConfigurationData.NonNodeData.SPServiceDatabasePrefix + 'Config')
                Role = 'db_owner'
                Ensure = 'Present'
                PsDscRunAsCredential = $SPSetupAccount
                DependsOn = '[SqlDatabaseOwner]SP-ConfigDB-DatabaseOwner'
            }
            # Der Farm Account erhält die 'WSS_Content_Application_Pools' Rolle auf der der SharePoint Config Datenbank
            SqlDatabaseRole SP-ConfigDB-WSS_Content_Application_Pools-FarmAccount
            {
                Name = $SPFarmAccount.Username.toString()
                ServerName = $SPServiceDatabaseServerAlias
                InstanceName = 'MSSQLSERVER'
                Database = ($ConfigurationData.NonNodeData.SPServiceDatabasePrefix + 'Config')
                Role = 'WSS_Content_Application_Pools'
                Ensure = 'Present'
                PsDscRunAsCredential = $SPSetupAccount
                DependsOn = '[SqlDatabaseOwner]SP-ConfigDB-DatabaseOwner'
            }

SQL Server edition and version the target node is running

Microsoft SQL Server 2017 (RTM-CU11) (KB4462262) - 14.0.3038.14 (X64) Sep 14 2018 13:53:44 Copyright (C) 2017 Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2016 Datacenter 10.0 (Build 14393: ) (Hypervisor)

SQL Server PowerShell modules present on the target node

Name Version Path


sqlserver 21.0.17279 C:\Program Files\WindowsPowerShell\Modules\sqlserver\sqlserver.psd1

The operating system the target node is running

OsName : Microsoft Windows Server 2016 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture : 64-bit
WindowsBuildLabEx : 14393.2485.amd64fre.rs1_release.180827-1809
OsLanguage : en-US
OsMuiLanguages : {en-US}

Version and build of PowerShell the target node is running

Name Value


PSVersion 5.1.14393.2485
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.2485
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

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

SqlServerDsc 12.0.0.0 C:\Program Files\WindowsPowerShell\Modules\SqlServerDsc\SqlServerDsc.psd1

@johlju
Copy link
Member

johlju commented Dec 4, 2018

Role is an array of roles. Currently the resource is created in such a way that the resource should be specified one time for each user, and all the roles that should be added should go as an array in the Role parameter/property.

@johlju johlju added by design The issue is describing an expect behavior. question The issue is a question. labels Dec 4, 2018
@johlju
Copy link
Member

johlju commented Dec 4, 2018

I think is discussed in issue #1002 too?

@johlju johlju added needs more information The issue needs more information from the author or the community. and removed question The issue is a question. labels Dec 4, 2018
@stale
Copy link

stale bot commented Jan 4, 2019

This issue has been automatically marked as stale because it has not had activity from the community in the last 30 days. It will be closed if no further activity occurs within 10 days. If the issue is labelled with any of the work labels (e.g bug, enhancement, documentation, or tests) then the issue will not auto-close.

@stale stale bot added the stale The issue or pull request was marked as stale because there hasn't been activity from the community. label Jan 4, 2019
@stale
Copy link

stale bot commented Feb 13, 2019

This issue has been automatically closed because it is has not had activity from the community in the last 40 days.

@stale stale bot closed this as completed Feb 13, 2019
johlju pushed a commit that referenced this issue Jun 4, 2019
…ng roles, managing membership (#1367)

- Changes to SqlDatabaseRole
  - BREAKING CHANGE: Refactored to enable creation/deletion of the database role
    itself as well as management of the role members. *Note that the resource no
    longer adds database users.* (issue #845, issue #847, issue #1252, issue #1339).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
by design The issue is describing an expect behavior. needs more information The issue needs more information from the author or the community. stale The issue or pull request was marked as stale because there hasn't been activity from the community.
Projects
None yet
2 participants