-
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
Connect-SQL: Using GetNetworkCredential().UserName which does not pass NetBIOS domain #1223
Comments
This is not an issue as long as the FQDN domain format is used, e.g. |
It is better that all |
- SqlServerDsc.Common - Connect-UncPath - Now support to authenticate using both NetBIOS domain and Fully Qualified Domain Name (FQDN) (issue #1223). - Connect-SQL - Now support to authenticate using both NetBIOS domain and Fully Qualified Domain Name (FQDN) (issue #1223). - Connect-SQLAnalysis - Now support to authenticate using both NetBIOS domain and Fully Qualified Domain Name (FQDN) (issue #1223). - SqlWindowsFirewall - Now support to authenticate using both NetBIOS domain and Fully Qualified Domain Name (FQDN) (issue #1223).
It seems that if not providing the NetBIOS name in the user name will successfully connect the user.
|
Reopening this issue since this should be documented in https://github.com/dsccommunity/SqlServerDsc/wiki/CredentialOverview. |
On second thought, let re-close this a open a new issue that points to this, |
Details of the scenario you tried and the problem that is occurring
When using the parameter
SetupCredential
of the helper functionConnect-SQL
to impersonate a user, and the login type is'WindowsUser'
, the username is extracted from the PSCredential object using the followinghttps://github.com/PowerShell/SqlServerDsc/blob/4ead35093c43954e69b413528355b1460bf7fdbd/SqlServerDscHelper.psm1#L76
This will not work if the username is written using the NetBIOS domain name. e.g.
'COMPANY\user'
. Since the then the domain name is in theGetNetworkCredential().Domain
property, and only the user name is in theGetNetworkCredential().UserName
property.This is not a problem when using the FQDN domain name, eg.
'[email protected]'
. Then the user name and the FQDN is part of theGetNetworkCredential().UserName
property.Verbose logs showing the problem
n/a
Suggested solution to the issue
Use the property
$SetupCredential.UserName
. That will always contain both the NetBIOS domain name or the FQDN domain name, together with the username.Although there is a slight issue with using that. Using the NetBIOS domain does not currently work in for example SQL Server 2016 (SQLPS). This might need to be documented as an requirement (to not use NetBIOS domain format).
But using FQDN or no domain name at all works.
The DSC configuration that is used to reproduce the issue (as detailed as possible)
n/a
SQL Server edition and version the target node is running
n/a
SQL Server PowerShell modules present on the target node
n/a
The operating system the target node is running
n/a
Version and build of PowerShell the target node is running
n/a
Version of the DSC module that was used ('dev' if using current dev branch)
dev
The text was updated successfully, but these errors were encountered: