SQLServer-PowerShell
SQLServer-PowerShell copied to clipboard
Az SQL instance link feedback
trafficstars
Hi @ClaudioESSilva, thanks for taking the time to improve MI Link scripts!
Did you manage to successfully establish a link? I didn't have a chance to test your commands yet, but looking at the diff, here's my initial set of thoughts
- In general, users may want to create multiple links between their On-Premise SQL server and SQL MI, i.e. for many databases. Technically we don't need to repeat all the one-time checks and setups (Sql server requirements, certificates, connectivity etc) E.g. this may take an array of dbs. Perhaps cmdlets can be designed in a way that separates repeatable actions vs one-time actions, I'd like to hear your opinion
- If we just straight run New-Link before Test-Requirements, we may end up in some slightly broken state where we'd need a cleanup (AGs for example)
- I haven't tried to add cert to MI this way so I'm curious if the link works properly https://github.com/ClaudioESSilva/SQLServer-PowerShell/blob/master/Azure%20SQL%20Managed%20Instance/Functions/New-MiLink.ps1#L266-L270. One of the reasons I was comparing PK from the MI (instead of just checking for the certificates with the same Name) is because the API won't let you create a cert if such public key blob already exists
- nitpicks: these ag names should be taken from user input params https://github.com/ClaudioESSilva/SQLServer-PowerShell/blob/master/Azure%20SQL%20Managed%20Instance/Functions/New-MiLink.ps1#L281-L284, here I'd echo a command that can perform full backup - if 'fixing' the requirements sounds as a bad idea in this context :) and this is arguably also a pre-requirement and/or a one-time thing (we don't need to do it for every link we create)
that's all for now, I'll take a deeper look in the coming days Please do let me know if you need any help with the link setup or decrypting my scripts, I'd be happy to help!