dbatools icon indicating copy to clipboard operation
dbatools copied to clipboard

Auto copy master cert for AG database adds

Open potatoqualitee opened this issue 3 years ago • 10 comments

Summarize Functionality

I just created Copy-DbaDbCertificate and added it to Start-DbaMigration. It was suggested that it'd be awesome to help enable auto setup of encrypted databases on AGs. Maybe it belongs in Copy-DbaDatabase as well 🤔

@andreasjordan any chance you can take a look? Start-DbaDbEncryption works with the containers at https://dbatools.io/docker

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

No

Technical Details

No response

potatoqualitee avatar Jan 17 '22 19:01 potatoqualitee

hmmm im doing a private presentation tomorrow at 9, i may jump in and submit a PR if i cant resist 😅

potatoqualitee avatar Jan 17 '22 19:01 potatoqualitee

I can try, but this week might get a bit busy...

andreasjordan avatar Jan 17 '22 19:01 andreasjordan

Ok, my lab is up and running...

I think copying the master cert will be a seperate step, because we need much more information than provided in Add-DbaAgDatabase. Example: With automatic seeding we don't have a shared path to transfer the certificate. And we need the passwords.

andreasjordan avatar Jan 17 '22 21:01 andreasjordan

ahhhh okay, we can add it in new-dbaavailabilitygroup since its a combo command anyway

potatoqualitee avatar Jan 17 '22 21:01 potatoqualitee

i also want to ask the SMO team if it's possible to just copy in memory, that'd be nice. but when i checked i believe it was "get" and not "get;set"

potatoqualitee avatar Jan 17 '22 21:01 potatoqualitee

asked: https://github.com/microsoft/sqlmanagementobjects/issues/76

potatoqualitee avatar Jan 17 '22 21:01 potatoqualitee

Ohh check it out, @andreasjordan ! Someone responded with this link, I think it'll be great for Copy-DbaDbCertificate https://docs.microsoft.com/en-us/sql/t-sql/functions/cert-id-transact-sql?view=sql-server-ver15

potatoqualitee avatar Jan 18 '22 18:01 potatoqualitee

So not using Backup-DbaDbCertificate and Restore-DbaDbCertificate anymore? Good idea. But I would need some time to implement and test - don't have that this week. Maybe on the weekend...

andreasjordan avatar Jan 20 '22 10:01 andreasjordan

Right! If it's possible. Seems possible 🤔

potatoqualitee avatar Jan 20 '22 11:01 potatoqualitee

Make that part an internal command so we can potentially reuse it elsehwere

potatoqualitee avatar Jan 20 '22 11:01 potatoqualitee