xDatabase
xDatabase copied to clipboard
DacFxInstallationError
Hi,
I'm trying to run the xDatabase DeployDac and I'm getting the following error:
VERBOSE: [WVM0TDSQLIMPRS1]: LCM: [ Start Set ] VERBOSE: [WVM0TDSQLIMPRS1]: LCM: [ Start Resource ] [[xDatabase]DeployDac] VERBOSE: [WVM0TDSQLIMPRS1]: LCM: [ Start Test ] [[xDatabase]DeployDac] VERBOSE: [WVM0TDSQLIMPRS1]: LCM: [ End Test ] [[xDatabase]DeployDac] in 0.0000 seconds. VERBOSE: [WVM0TDSQLIMPRS1]: LCM: [ Start Set ] [[xDatabase]DeployDac] VERBOSE: [WVM0TDSQLIMPRS1]: LCM: [ End Set ] [[xDatabase]DeployDac] in 0.0160 seconds. PowerShell DSC resource MSFT_xDatabase failed to execute Set-TargetResource functionality with error message: System.Collections.Hashtable.DacFxInstallationError + CategoryInfo : InvalidOperation: (:) [], CimException + FullyQualifiedErrorId : ProviderOperationExecutionFailure + PSComputerName : WVM0TDSQLIMPRS1
The SendConfigurationApply function did not succeed. + CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException + FullyQualifiedErrorId : MI RESULT 1 + PSComputerName : WVM0TDSQLIMPRS1
VERBOSE: Operation 'Invoke CimMethod' complete.
Background info:
- Windows Server 2008 R2 Standard, Virtual Machine (no Internet access)
- SQL Server 2008 R2 (Tools feature installed)
- Installed Microsoft® SQL Server® Data-Tier Application Framework (February 2015) both x86 and x64 bits.
C:\Program Files (x86)\Microsoft SQL Server\120\DAC\bin C:\Program Files\Microsoft SQL Server\120\DAC\bin
Event Logs (Desired State Configuration logs)
Job {990EF2D5-DA5E-11E5-8C98-001DD8B71E6E} : This event indicates that failure happens when LCM is processing the configuration. ErrorId is 0x1. ErrorDetail is The SendConfigurationApply function did not succeed.. ResourceId is [xDatabase]DeployDac and SourceInfo is C:\Windows\DtlDownloads\IMpress Database\Deployment\DeployDatabaseEmpty.ps1::17::9::xDatabase. ErrorMessage is PowerShell DSC resource MSFT_xDatabase failed to execute Set-TargetResource functionality with error message: System.Collections.Hashtable.DacFxInstallationError .
Lastly, here's the script:
configuration IMpressDb { Import-DscResource -Module xDatabase
node 'WVM0TDSQLIMPRS1'
{
xDatabase DeployDac
{
Ensure = "Present"
SqlServer = "WVM0TDSQLIMPRS1\StdSSDS"
SqlServerVersion = "2008-R2"
DatabaseName = "IMpress_Empty"
DacPacPath = "C:\Windows\DtlDownloads\IMpress Database\IMpress.Database.dacpac"
DacPacApplicationName = "IMpress"
}
}
}
IMpressDb -ConfigurationData "C:\Windows\DtlDownloads\IMpress Database\Deployment\configuration.psd1" -PackagePath "D:\PSTest"
Start-DscConfiguration -Path "C:\Windows\system32\IMpressDb" -Verbose -Wait -Force
What am I missing ?
For those having the same issues - The problem was with the "wrong" installation of required files on the sql server. The best is to go to the "C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin" 110 being the version of the SQL DacFx closest to your installation.
In my scenario, the server is Sql 2008-R2, but the tools are for Sql 2012. Note that this DacFx has many dependencies.
Now, run the SqlPackage.exe until that exe works. When your depencies are resolved, and this exe works, you're all set to use xDatabase DeployDac.
The SqlServerVersion controls which version of the DacFx is used (110, 120 etc) - if you set it to 2012 then it will use the right tools. I was going to submit a pr to just pick the highest installed version but I have had trouble getting my other pr's in and was thinking of just starting a community version of xDatabase from scratch.
The module only checks for the files it needs to import a dacpac file in ${env:ProgramFiles(x86)} and not in the newer "Program Files". You need to copy the DAC/bin folder that includes "Microsoft.SqlServer.Dac.dll" to the same version folder in Program Files (x86). I found mine under the version 140 folder, presumably because I installed SQL server 2017. I didn't bother to test copying individual files until it worked. If I have time, I might try modifying the relevant part of the module which is the "Load-DacFx" function in xDatabase_Common.psm1