microsoft / Code-Search

Code Search Admin scripts (SQL and PS) for managing a Code Search on-prem instance
53 stars 65 forks source link

Any updated script that can be used for azure sql db connection? #92

Open Coco-Kong opened 1 year ago

Coco-Kong commented 1 year ago

https://learn.microsoft.com/en-us/azure/devops/server/install/install-azure-sql?view=azure-devops-2022 It's possible to use ADO server with azure SQL db. but elastic search scipt provided here only works for onprem environment.

e.g. $SqlFullPath = Join-Path $PWD -ChildPath 'CollectionDBDiagnosticScripts\IndexingUnitData.sql' $queryResults = Invoke-Sqlcmd -InputFile $SqlFullPath -serverInstance $SQLServerInstance -database $CollectionDatabaseName

Invoke-Sqlcmd here uses windows logon, not azure managed identity. And there are many places in the script using Invoke-Sqlcmd. Hence it cannot connect to azure sql db.

Could you modify the script and share an updated version which can be used for azure sql db connection as well?