Comments (11)
Have you tried using both NETBOIS and FQDN; e.g. DOMAIN\myaccount
and [email protected]
does neither work?
from sqlserverdsc.
That SqlSetup says that the domain account does not exist, that I have never seen before I would have assumed it actually do not exist. 🤔 Let the issue focus on SqlServiceAccount that you provided verbose output for, fixing that would probably solve the other one.
from sqlserverdsc.
Have you tried using both NETBOIS and FQDN; e.g.
DOMAIN\myaccount
and[email protected]
does neither work?
Yes, I've attempted both.
from sqlserverdsc.
That SqlSetup says that the domain account does not exist, that I have never seen before I would have assumed it actually do not exist. 🤔 Let the issue focus on SqlServiceAccount that you provided verbose output for, fixing that would probably solve the other one.
I can update manually after the install is done without issue. So the account does exists and is valid. I also agree with you, it's a weird error that I've not seen previously.
Could this a permission error authenticating to Active Directory? Not sure how I could check this either.....
from sqlserverdsc.
It looks like you running the configuration as SYSTEM which can be an issue. When you do it manually you do it probably as a domain user. Suggest debugging this at your end, for example trying these as the user (SYSTEM) the configuration runs at.
But you should probably run the resource as a domain user to be able to set domain users. 🤔
$managedComputer = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer -ArgumentList '<ServerName>'
$managedComputer.Services.Name
$serviceObject = $managedComputer.Services | Where-Object -FilterScript {
$_.Name -eq '<ServiceName>'
}
$serviceObject.SetServiceAccount('<UserName>', '<Password>')
from sqlserverdsc.
It looks like you running the configuration as SYSTEM which can be an issue. When you do it manually you do it probably as a domain user. Suggest debugging this at your end, for example trying these as the user (SYSTEM) the configuration runs at. But you should probably run the resource as a domain user to be able to set domain users. 🤔
$managedComputer = New-Object -TypeName Microsoft.SqlServer.Management.Smo.Wmi.ManagedComputer -ArgumentList '<ServerName>' $managedComputer.Services.Name $serviceObject = $managedComputer.Services | Where-Object -FilterScript { $_.Name -eq '<ServiceName>' } $serviceObject.SetServiceAccount('<UserName>', '<Password>')
@johlju, the code above works as long as I've imported the DBATools module for SMO. I attempted running as my personal account and as the SYSTEM user via psexec.exe sysinternal tool. Both work and successful set the service account. So this doesn't appear to be an issue with the SYSTEM account.
I've confirmed that the the DBATools are getting installed before I start the DSC build. How can I validate that the import-module has been run via the DSC to ensure the SMO is available?
from sqlserverdsc.
from sqlserverdsc.
I added the following to my DSC to get that variable set. I does get created and I'm still having the issue. This is done before I install SQL Server.
Environment AddSMOEnvironmentVariable
{
Ensure = 'Present'
Name = 'SMODefaultModuleName'
Value = 'dbatools'
}
Also, I've updated the DSC command to a run as account and am using my personal for testing as I know it can appropriately set the credentials:
SqlServiceAccount setDBEngineRunAsAccount
{
InstanceName = 'MSSQLSERVER'
ServiceType = 'DatabaseEngine'
ServiceAccount = $ServiceAccount
RestartService = $true
PsDscRunAsCredential = $RunAs
DependsOn = '[Environment]AddSMOEnvironmentVariable'
}
When running it this way, I get the following error:
Message System.InvalidOperationException: Unable to set the service account for AT14BLDTESTDB01 on MSSQLSERVER. Message ---> System.Management.Automation.MethodInvocationException: Exception calling "SetServiceAccount" with "2" argument(s): "Set service account failed. " ---> Microsoft.SqlServer.Management.Smo.FailedOperationException: Set service account failed. ---> Microsoft.SqlServer.Management.Smo.FailedOperationException: SetServiceAccount failed for Service 'MSSQLSERVER'. ---> System.Runtime.InteropServices.COMException
at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
at System.Management.ManagementObject.InvokeMethod(String methodName, ManagementBaseObject inParameters, InvokeMethodOptions options)
at System.Management.ManagementObject.InvokeMethod(String methodName, Object[] args)
at Microsoft.SqlServer.Management.Smo.Wmi.WmiSmoObject.InvokeMgmtMethod(ManagementObject mo, ManagementOperationObserver observer, String methodName, Object[] parameters)
--- End of inner exception stack trace ---
at Microsoft.SqlServer.Management.Smo.Wmi.WmiSmoObject.InvokeMgmtMethod(ManagementObject mo, ManagementOperationObserver observer, String methodName, Object[] parameters)
at Microsoft.SqlServer.Management.Smo.Wmi.Service.SetServiceAccount(String userName, String password)
...
from sqlserverdsc.
I wonder if this is because it loads the wrong assemblies in a resource prior. Can you confirm that if you just run the resources Environment
and SqlServiceAccount
it still fails? Can you do this on a newly restarted machine to make sure there are no other session that the LCM has ran.
Also, can you get the verbose output for that new run.
You can also try running the resource using Invoke-DscResource
to see if it fails then too.
from sqlserverdsc.
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 40 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.
from sqlserverdsc.
I wonder if this is because it loads the wrong assemblies in a resource prior. Can you confirm that if you just run the resources
Environment
andSqlServiceAccount
it still fails? Can you do this on a newly restarted machine to make sure there are no other session that the LCM has ran.Also, can you get the verbose output for that new run.
You can also try running the resource using
Invoke-DscResource
to see if it fails then too.
Apologies on the delayed response. We did get it figured out. Weird routing issue with AD sending the request to our Europe AD Servers, causing the auth to timeout. Wish the error logging had been better from MS in the bootstrap log.. Regardless, we can mark this closed.
from sqlserverdsc.
Related Issues (20)
- SqlIntegrationServicesCatalog: Resource to perform the initial creation of the Integration Services Catalog HOT 5
- [SqlAGListeners]SqlAGListeners] The character length of the 16 argument is too long HOT 4
- SqlDatabaseObjectPermission: INSERT permission never shows as InDesiredState when other permissions are on the table HOT 4
- SqlRs: Integration test fails on SQL Server 2022 HOT 3
- Install-SqlDscReportingServices: New command proposal
- Get-SqlDscReportingServices: New command proposal
- Uninstall-SqlDscReportingServices: New command proposal
- Get-SqlDscReportingsServicesConfiguration: New command proposal
- Initialize-SqlDscReportServer: New command proposal
- Set-SqlDscReportServerVirtualDirectory: New command proposal
- Add-SqlDscReportServerUrlReservation: New command proposal
- Request-SqlDscReportServerDatabaseScript: New command proposal
- Register-SqlDscReportServerDatabaseScript: New command proposal HOT 1
- Request-SqlDscReportServerDatabaseRightsScript: New command proposal
- Register-SqlDscReportServerDatabaseRightsScript: New command proposal HOT 1
- Set-SqlDscReportServerDatabaseConnection: New command proposal
- Enable-SqlDscReportServerTls: New command proposal HOT 1
- Disable-SqlDscReportServerTls: New command proposal
- Remove-SqlDscReportServerUrlReservation: New command proposal
- Restore-SqlDscDatabase: New command proposal HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sqlserverdsc.