Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backup-DbaServiceMasterKey - Support Custom Backup File Name #9483

Open
serenefiresiren opened this issue Oct 1, 2024 · 2 comments
Open
Labels
feature triage required New issue that has not been reviewed by maintainers

Comments

@serenefiresiren
Copy link
Contributor

serenefiresiren commented Oct 1, 2024

Summarize Functionality

TSQL Command allows specifying the file name when backing up the service master key. Backup-DbaServiceMasterKey currently automatically sets the filename. It would be nice to have the option here as well.
Relates to #9484 , #9485

Is there a command that is similiar or close to what you are looking for?

Yes

Technical Details

SQL Command

BACKUP SERVICE MASTER KEY
 TO FILE = 'c:\sqlbackup\MainServiceMaster.key'
 ENCRYPTION BY PASSWORD = 'S3cureP@ssword!sneeded'

Existing file name command, line 119
$filename = Join-DbaPath -SqlInstance $server -Path $Path -ChildPath "$fileinstance-servicemasterkey.key"

Suggested change adding an option Filename parameter

param (
       [parameter(Mandatory, ValueFromPipeline)]
       [DbaInstanceParameter[]]$SqlInstance,
       [PSCredential]$SqlCredential,
       [PSCredential]$KeyCredential,
       [Alias("Password")]
       [Security.SecureString]$SecurePassword,
       [string]$Path,
       **[string]$ChildPath,
       [Alias("FileName")]**
       [switch]$EnableException
   )
#
#
#
# pseudo
$ChildPath = $ChildPath or if null then $fileinstance-servicemasterkey.key" 
$filename = Join-DbaPath -SqlInstance $server -Path $Path -ChildPath $ChildPath 

@wsmelton
Copy link
Member

wsmelton commented Oct 4, 2024

Is there any difference to you just running Rename-Item after the command?

@serenefiresiren
Copy link
Contributor Author

See #9485 for discussion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature triage required New issue that has not been reviewed by maintainers
Projects
None yet
Development

No branches or pull requests

2 participants