dsccommunity / dsccommunity/SqlServerDsc
SqlRS: Does not work when reporting database machine is renamed
Nobody has claimed this yet.
- Dominant language
- PowerShell
- Stars
- 385
- Forks
- 224
- PR merge metrics
- No merged PRs in 30d
Description
Details of the scenario you tried and the problem that is occurring:
I am trying to use xSQLServerRSConfig to set SSRS's database connection after the machine with the reporting database has been renamed. There are two problems:
-
xSQLServerRSConfig is running the database creation scripts even though the database is already created, resulting in errors when trying to recreate it. This is because it is checking isInitialized to determine if the DB should be created, but this variable seems to only indicate if the encryption keys have been generated, which in my case have not, probably due to the rename.
-
Immediately after setting the new database connection and initializing the report server, xSQLServerRSConfig tests the resource values again and fails because isInitialized is still $false. This value only becomes $true after 30 seconds or so in my environment. It seems like there needs to be come sort of wait here for the initialization to complete. Also, I am not sure if reinitializing a report server like this will cause encrypted data to be lost. Maybe if a rename is detected the keys should be backed up and restored?
The DSC configuration that is using the resource (as detailed as possible):
This should be reproducible with a barebones configuration where the SQL Server with the reporting database has been renamed:
Configuration RSConfig {
Import-DscResource -ModuleName xSqlServer
Node $Node {
xSQLServerRSConfig RSConfig {
InstanceName = 'MSSQLSERVER'
RSSQLServer = $NewSqlServerComputerName
RSSQLInstanceName = 'MSSQLSERVER'
}
}
}
Version of the Operating System, SQL Server and PowerShell the DSC Target Node is running:
Windows Server 2012 R2 6.3.9600
SQL Server 2016 SP1 13.0.4001.0
PowerShell:
Name Value
---- -----
PSVersion 5.1.14409.1005
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14409.1005
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
What module (SqlServer or SQLPS) and which version of the module the DSC Target Node is running:
SqlServer 21.0.17178
Version of the DSC module you're using, or 'dev' if you're using current dev branch:
8.2.0.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the xSQLServerRSConfig resource and reproduce the barebones configuration against a renamed SQL Server reporting database. Investigate why database creation is triggered when the database already exists and why validation runs before isInitialized becomes true; done means the renamed-server configuration completes without recreating the database or failing prematurely, while preserving encrypted data behavior as clarified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell, sql
- Domain
- databases, devops
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100