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

BREAKING CHANGE: SqlLogin: Enforces parameters even if they are not in the configuration #1669

Closed
johlju opened this issue Jan 11, 2021 · 1 comment · Fixed by #1696
Closed
Labels
breaking change When used on an issue, the issue has been determined to be a breaking change. enhancement The issue is an enhancement request.

Comments

@johlju
Copy link
Member

johlju commented Jan 11, 2021

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

The resource SqlLogin is enforcing parameters to a default value even if the user did not opt-in to enforce it in a configuration. That means if a user leaves out for example the parameter LoginPasswordExpirationEnabled from the configuration then the resource will set its default value even if the users did not want to.

Verbose logs showing the problem

not available

Suggested solution to the issue

These parameters should no longer have default values.

[Parameter()]
[System.Boolean]
$LoginMustChangePassword = $true,
[Parameter()]
[System.Boolean]
$LoginPasswordExpirationEnabled = $true,
[Parameter()]
[System.Boolean]
$LoginPasswordPolicyEnforced = $true,

The parameters should never be enforced unless the are part of the configuration.

For example, this evaluation:

if ( $login.PasswordPolicyEnforced -ne $LoginPasswordPolicyEnforced )

should have been:

if ($PSBoundParameters.ContainsKey('PasswordPolicyEnforced') -and $login.PasswordPolicyEnforced -ne $LoginPasswordPolicyEnforced)

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

If the SQL login exist with the LoginPasswordExpirationEnabled set to $false then this configuration will change the LoginPasswordExpirationEnabled to $true even if it is not part of the configuration.

SqlLogin 'Add_WindowsGroup'
{
    Name                 = 'CONTOSO\User1'
    LoginType            = 'WindowsUser'
    InstanceName         = 'DSC'
}

SQL Server edition and version the target node is running

All

SQL Server PowerShell modules present on the target node

not applicable

The operating system the target node is running

not applicable

Version and build of PowerShell the target node is running

not applicable

Version of the DSC module that was used

main

@johlju johlju added breaking change When used on an issue, the issue has been determined to be a breaking change. enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. labels Jan 11, 2021
bozho added a commit to bozho/SqlServerDsc that referenced this issue Mar 10, 2021
…xpirationEnabled and LoginPasswordPolicyEnforced parameters no longer enforce default values
bozho added a commit to bozho/SqlServerDsc that referenced this issue Mar 10, 2021
@bozho
Copy link
Contributor

bozho commented Mar 10, 2021

@johlju I've hit this problem with an SqlLogin resource disabling sa login on new deployments.

Submitted a patch, let me know if you think I should add some tests.

bozho added a commit to bozho/SqlServerDsc that referenced this issue Mar 26, 2021
…xpirationEnabled and LoginPasswordPolicyEnforced parameters no longer enforce default values
bozho added a commit to bozho/SqlServerDsc that referenced this issue Mar 26, 2021
bozho added a commit to bozho/SqlServerDsc that referenced this issue May 5, 2021
…xpirationEnabled and LoginPasswordPolicyEnforced parameters no longer enforce default values
bozho added a commit to bozho/SqlServerDsc that referenced this issue May 5, 2021
bozho added a commit to bozho/SqlServerDsc that referenced this issue May 5, 2021
bozho added a commit to bozho/SqlServerDsc that referenced this issue Jul 1, 2021
…xpirationEnabled and LoginPasswordPolicyEnforced parameters no longer enforce default values
bozho added a commit to bozho/SqlServerDsc that referenced this issue Jul 1, 2021
bozho added a commit to bozho/SqlServerDsc that referenced this issue Jul 1, 2021
bozho added a commit to bozho/SqlServerDsc that referenced this issue Sep 13, 2021
…xpirationEnabled and LoginPasswordPolicyEnforced parameters no longer enforce default values
bozho added a commit to bozho/SqlServerDsc that referenced this issue Sep 13, 2021
bozho added a commit to bozho/SqlServerDsc that referenced this issue Sep 13, 2021
bozho added a commit to bozho/SqlServerDsc that referenced this issue Sep 13, 2021
bozho added a commit to bozho/SqlServerDsc that referenced this issue Sep 28, 2021
bozho added a commit to bozho/SqlServerDsc that referenced this issue Oct 4, 2021
@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 Oct 9, 2021
bozho added a commit to bozho/SqlServerDsc that referenced this issue Oct 12, 2021
johlju pushed a commit to bozho/SqlServerDsc that referenced this issue Mar 13, 2022
…xpirationEnabled and LoginPasswordPolicyEnforced parameters no longer enforce default values
johlju pushed a commit to bozho/SqlServerDsc that referenced this issue Mar 13, 2022
johlju pushed a commit to bozho/SqlServerDsc that referenced this issue Mar 13, 2022
johlju pushed a commit to bozho/SqlServerDsc that referenced this issue Mar 13, 2022
johlju pushed a commit to bozho/SqlServerDsc that referenced this issue Mar 13, 2022
johlju pushed a commit to bozho/SqlServerDsc that referenced this issue Mar 13, 2022
bozho added a commit to bozho/SqlServerDsc that referenced this issue Mar 28, 2022
bozho added a commit to bozho/SqlServerDsc that referenced this issue Mar 28, 2022
…d value for DSC_SqlLogin_AddLoginDscUser5_Config
johlju pushed a commit that referenced this issue Mar 28, 2022
#1696)

- SqlLogin
  - BREAKING CHANGE: `LoginMustChangePassword`, `LoginPasswordExpirationEnabled` and `LoginPasswordPolicyEnforced`
    parameters no longer enforce default values (issue #1669).
@johlju johlju removed the in progress The issue is being actively worked on by someone. label Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change When used on an issue, the issue has been determined to be a breaking change. enhancement The issue is an enhancement request.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants