-
Notifications
You must be signed in to change notification settings - Fork 225
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
SqlLogin: Issues with sql-native accounts. #1032
Comments
Thanks for a detailed issue description! I labeled this as a bug even if some are an enhancement. In regards to the behavior to it changing password back to the initial password. Maybe we should add a |
I think this is related to issue #1048. I guess it was never possible, at least with SQL Server 2016, to validate the SQL Login password correctly. |
It looks like Claudio has fixed the logon test, I think the setting the password wrongly part needs a check for SQL versions (pass a secure string in 2016 and a string in older versions). I'd add a "Let the password change" switch so it doesn't change existing behaviour (having "force" assumed to be true isn't nice). |
…' type (#1652) - SqlLogin - Added functionality to throw exception if an update to the `LoginMustChangePassword` value on an existing SQL Login is attempted. This functionality is not supported by referenced, SQL Server Management Object (SMO), libraries and cannot be supported directly by this module. - Added integration tests to ensure that an added (or updated) `SqlLogin` can connect into a SQL instance once added (or updated). - Added integration tests to ensure that the default database connected to by a `SqlLogin` is the same as specified in the resource's `DefaultDatabase` property/parameter. - Reversed order in which `PasswordExpirationEnabled` and `PasswordPolicyEnforced` are updated within `SqlLogin` resource. `PasswordPolicyEnforced` is now updated first. - Added integration tests to assert `LoginPasswordExpirationEnabled`, `LoginPasswordPolicyEnforced` and `LoginMustChangePassword` properties/parameters are applied and updated correctly. Similar integration tests also added to ensure the password of the `SqlLogin` is updated if the password within the `SqlCredential` value/object is changed (issue #361, issue #1032, and issue #1050). - Updated `SqlLogin`, integration tests to make use of amended `Wait-ForIdleLcm`, helper function, `-Clear` switch usage to remove intermittent, integration test failures (issue #1634).
I'm build SQL server 2012 boxes for the a test team and the test set up is configured to use a SQL native logon with an insecure password.
We had some problems where the password was "spontaneously" changing which we traced to the xSQL DSC resource. I distilled the (complex, hundreds of settings) DSC script down to this
If I run wibble with config data and a valid credential the first time it creates the account exactly as required. I can logon in SQL Management studio , and connect from SQL native client using the creds.
If I run it as second time, a message is displayed saying the "Password Validation failed for the login ...", set runs and thereafter the logon is broken.
Now... Set-SQLServerLoginPassword calls $login.changePassword() with a secure string. On MSDN the documentation here https://msdn.microsoft.com/en-us/library/mt697759.aspx it says that the method takes a secure string. But on my sql 2012 box the method reports that it takes a string, which makes me think that password is being changed to a secure-string representation of the password.
Further in the test-target resource if the loginType is 'SQLLogin' it will check if the password has changed. THIS IS BAD because the login should be created but shouldn't be forced back to its initial password if the password is changed later. It is worse because the check is by calling Connect-SQL which does not set the $sql.connectionContext.secureLogin and so ONLY works with Windows logins, not SQL ones . So the test will always report the SQL native login has the wrong password, meaning the SET part will always be called, and if a password is included SET will always invoke Set-SQLServerLoginPassword.
For now I have removed the reset password behaviour and the test for a changed password from my own version. That may not be best for the public version.
The text was updated successfully, but these errors were encountered: