Skip to content

Set‑SqlDscRSDatabaseConnection

dscbot edited this page Jan 5, 2026 · 1 revision

SYNOPSIS

Sets the report server database connection for SQL Server Reporting Services.

SYNTAX

Set-SqlDscRSDatabaseConnection [-Configuration] <Object> [-ServerName] <String> [[-InstanceName] <String>]
 [-DatabaseName] <String> [[-Type] <String>] [[-Credential] <PSCredential>] [-PassThru] [-Force]
 [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

Sets the report server database connection for SQL Server Reporting Services or Power BI Report Server by calling the SetDatabaseConnection method on the MSReportServer_ConfigurationSetting CIM instance.

This command configures which database the report server should use for storing report definitions, metadata, and other report server data.

The configuration CIM instance can be obtained using the Get-SqlDscRSConfiguration command and passed via the pipeline.

EXAMPLES

EXAMPLE 1

Get-SqlDscRSConfiguration -InstanceName 'SSRS' | Set-SqlDscRSDatabaseConnection -ServerName 'localhost' -DatabaseName 'ReportServer'

Sets the report server database connection to use the 'ReportServer' database on 'localhost' using the report server service account.

EXAMPLE 2

$config = Get-SqlDscRSConfiguration -InstanceName 'SSRS'
Set-SqlDscRSDatabaseConnection -Configuration $config -ServerName 'SqlServer01' -InstanceName 'MSSQLSERVER' -DatabaseName 'ReportServer' -Confirm:$false

Sets the report server database connection without confirmation.

EXAMPLE 3

$credential = Get-Credential
Get-SqlDscRSConfiguration -InstanceName 'SSRS' | Set-SqlDscRSDatabaseConnection -ServerName 'SqlServer01' -DatabaseName 'ReportServer' -Type 'SqlServer' -Credential $credential

Sets the report server database connection using SQL Server authentication with the specified credentials.

EXAMPLE 4

Get-SqlDscRSConfiguration -InstanceName 'SSRS' | Set-SqlDscRSDatabaseConnection -ServerName 'localhost' -DatabaseName 'ReportServer' -PassThru

Sets the database connection and returns the configuration CIM instance.

PARAMETERS

-Configuration

Specifies the MSReportServer_ConfigurationSetting CIM instance for the Reporting Services instance. This can be obtained using the Get-SqlDscRSConfiguration command. This parameter accepts pipeline input.

Type: Object
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-Credential

Specifies the credentials for connecting to the database when using 'Windows' or 'SqlServer' credentials type. This parameter is required when Type is 'Windows' or 'SqlServer'.

Type: PSCredential
Parameter Sets: (All)
Aliases:

Required: False
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-DatabaseName

Specifies the name of the report server database. Common names are 'ReportServer' or 'ReportServer$InstanceName'.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Force

If specified, suppresses the confirmation prompt.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-InstanceName

Specifies the name of the SQL Server instance that hosts the report server database. If not specified, the default instance is used.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-PassThru

If specified, returns the configuration CIM instance after setting the database connection.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-ServerName

Specifies the name of the server that hosts the report server database.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Type

Specifies the type of credentials to use for the database connection. Valid values are:

  • 'Windows': Windows authentication with specified credentials.
  • 'SqlServer': SQL Server authentication with specified credentials.
  • 'ServiceAccount': Windows Service integrated security using the report server service account.

The default is 'ServiceAccount'.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 5
Default value: ServiceAccount
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

Microsoft.Management.Infrastructure.CimInstance

Accepts MSReportServer_ConfigurationSetting CIM instance via pipeline.

OUTPUTS

None. By default, this command does not generate any output.

Microsoft.Management.Infrastructure.CimInstance

When PassThru is specified, returns the MSReportServer_ConfigurationSetting

CIM instance.

NOTES

The Reporting Services service may need to be restarted for the change to take effect.

When using Type 'ServiceAccount', the report server web service will use either the ASP.NET account or an application pool's account and the Windows service account to access the report server database.

RELATED LINKS

https://docs.microsoft.com/en-us/sql/reporting-services/wmi-provider-library-reference/configurationsetting-method-setdatabaseconnection

Home

Commands

How-to

Resources

Usage

Clone this wiki locally