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

Conflict when configuring multiple databases #647

Closed
General-Fault opened this issue Jun 4, 2020 · 1 comment · Fixed by #648
Closed

Conflict when configuring multiple databases #647

General-Fault opened this issue Jun 4, 2020 · 1 comment · Fixed by #648
Assignees
Labels
bug Something isn't working
Milestone

Comments

@General-Fault
Copy link

Describe the bug
When a system has multiple SqlServer databases on a single server instance, the generated rules will contain conflicts.

To Reproduce

  1. Create a basic configuration containing a SqlServer resource with the SqlRole = "Database" and define at least two databases.
Configuration TestConfig {
    Import-DscResource -ModuleName 'PowerSTIG' -ModuleVersion '4.3.0'

    Node localhost {
      
        SqlServer DatabaseSettings {
            SqlVersion = '2012'
            SqlRole = 'Database'
            StigVersion = '1.19'
            ServerInstance = '.\DatabaseInstance'
            Database = 'DatabaseA', 'DatabaseB'
        }
    }
}
  1. Compile the configuration TestConfig -Verbose

  2. The compilation will fail with this error:

SqlServerDsc\SqlScriptQuery : A duplicate resource identifier '[SqlScriptQuery][V-41402][medium][SRG-APP-000089-DB-000064].\DatabaseInstance::[SqlServer]DatabaseSettings' was found while processing the
specification for node 'localhost'. Change the name of this resource so that it is unique within the node specification.
  1. Similarly creating two resources:
  SqlServer DatabaseASettings {
            SqlVersion = '2012'
            SqlRole = 'Database'
            StigVersion = '1.19'
            ServerInstance = '.\DatabaseInstance'
            Database = 'DatabaseA'
        }

        SqlServer DatabaseBSettings {
            SqlVersion = '2012'
            SqlRole = 'Database'
            StigVersion = '1.19'
            ServerInstance = '.\DatabaseInstance'
            Database = 'DatabaseB'
        }

also fails:

Test-ConflictingResources : A conflict was detected between resources '[SqlScriptQuery][V-41402][medium][SRG-APP-000089-DB-000064].\DatabaseInstance::[SqlServer]DatabaseASettings (C:\Program
Files\WindowsPowerShell\Modules\PowerSTIG\4.3.0\DSCResources\Resources\SqlServer.ScriptQuery.ps1::14::17::SqlScriptQuery)' and
'[SqlScriptQuery][V-41402][medium][SRG-APP-000089-DB-000064].\DatabaseInstance::[SqlServer]DatabaseBSettings (C:\Program
Files\WindowsPowerShell\Modules\PowerSTIG\4.3.0\DSCResources\Resources\SqlServer.ScriptQuery.ps1::14::17::SqlScriptQuery)' in node 'localhost'. Resources have identical key properties but there are
differences in the following non-key properties: 'Variable'. Values 'Database=DatabaseA' don't match values 'Database=DatabaseB'. Please update these property values so that they are identical in both cases.

Expected behavior
The resource identifier for the rule should contain the database name to differentiate it from other rules.

Additional context
This system I am attempting to configure contains one SqlServer named instance containing two databases.

@erjenkin erjenkin self-assigned this Jun 4, 2020
@erjenkin erjenkin added the bug Something isn't working label Jun 4, 2020
@erjenkin erjenkin added this to the 4.4.0 milestone Jun 4, 2020
@erjenkin erjenkin linked a pull request Jun 4, 2020 that will close this issue
5 tasks
@erjenkin
Copy link
Member

erjenkin commented Jun 4, 2020

@General-Fault,
Thanks for the issue. I have a fix in that will allow for multiple databases to be specified with the sqlscriptquery rule 41402. You will see this fix in milestone 4.4.0 which will release next month.

Let me know if you see any other issues,

Thanks again,

Eric

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants