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?
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?