Skip to content

Backup‑SqlDscRSEncryptionKey

dscbot edited this page Jan 17, 2026 · 1 revision

SYNOPSIS

Backs up the encryption key for SQL Server Reporting Services.

SYNTAX

Backup-SqlDscRSEncryptionKey -Configuration <Object> -Path <String> -Password <SecureString>
 [-Credential <PSCredential>] [-DriveName <String>] [-PassThru] [-Force] 
 [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION

Backs up the encryption key for SQL Server Reporting Services or Power BI Report Server by calling the BackupEncryptionKey method on the MSReportServer_ConfigurationSetting CIM instance.

The encryption key is essential for decrypting stored credentials and connection strings in the report server database. This backup should be stored securely and is required for disaster recovery or migration scenarios.

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

EXAMPLES

EXAMPLE 1

$password = Read-Host -AsSecureString -Prompt 'Enter backup password'
Get-SqlDscRSConfiguration -InstanceName 'SSRS' | Backup-SqlDscRSEncryptionKey -Path 'C:\Backup\RSKey.snk' -Password $password

Backs up the encryption key to a local file.

EXAMPLE 2

$password = ConvertTo-SecureString -String 'MyP@ssw0rd' -AsPlainText -Force
$config = Get-SqlDscRSConfiguration -InstanceName 'SSRS'
Backup-SqlDscRSEncryptionKey -Configuration $config -Path '\Server\Share\RSKey.snk' -Password $password -Credential (Get-Credential) -Force

Backs up the encryption key to a UNC path with credentials and without confirmation.

EXAMPLE 3

$password = Read-Host -AsSecureString -Prompt 'Enter backup password'
Get-SqlDscRSConfiguration -InstanceName 'SSRS' | Backup-SqlDscRSEncryptionKey -Path 'C:\Backup\RSKey.snk' -Password $password -PassThru

Backs up the encryption key 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: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-Credential

Specifies the credentials to use when accessing a UNC path. Use this parameter when the Path is a network share that requires authentication.

Type: PSCredential
Parameter Sets: (All)
Aliases:

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

-DriveName

Specifies the name of the temporary PSDrive to create when accessing a UNC path with credentials. Defaults to 'RSKeyBackup'. This parameter can only be used together with the Credential parameter.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: RSKeyBackup
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

-PassThru

If specified, returns the configuration CIM instance after backing up the encryption key.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-Password

Specifies the password to protect the encryption key backup file. This password will be required when restoring the encryption key.

Type: SecureString
Parameter Sets: (All)
Aliases:

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

-Path

Specifies the full path where the encryption key backup file will be saved. The file extension should be .snk (Strong Name Key).

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
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

Store the backup file and password securely. They are required to restore the encryption key in disaster recovery scenarios or when migrating to a new server.

RELATED LINKS

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

Home

Commands

How-to

Resources

Usage

Clone this wiki locally