The problematic script is:
1migrate.exe Core.dll /verbose /connectionString="DataSource=server-name;Initial Catalog=db-name;Integrated Security=True; "/connectionProviderName="System.Data.SqlClient "
I opened the machine that runs the Pipeline Agent and it performs the migration correctly.
When the same script runs under a Command Line task I get the error below:
2020-11-03T14:45:20.1962744Z ##[section]Starting: Command Line Script 2020-11-03T14:45:20.2058194Z ============================================================================== 2020-11-03T14:45:20.2058419Z Task : Command line 2020-11-03T14:45:20.2058637Z Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows 2020-11-03T14:45:20.2058833Z Version : 2.177.2 2020-11-03T14:45:20.2058981Z Author : Microsoft Corporation 2020-11-03T14:45:20.2059204Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line 2020-11-03T14:45:20.2059450Z ============================================================================== 2020-11-03T14:45:21.0758733Z Generating script. 2020-11-03T14:45:21.0836319Z Script contents: 2020-11-03T14:45:21.0849117Z migrate.exe Core.dll /verbose /connectionString="Data Source=server-name;Initial Catalog=db-name;Integrated Security=True; " /connectionProviderName="System.Data.SqlClient " 2020-11-03T14:45:21.1141401Z ========================== Starting Command Output =========================== 2020-11-03T14:45:21.1356562Z ##[command]"C:\Windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "C:\pipeline-agent_work_temp\6db07e4c-052c-4aa1-b103-db71bebfec26.cmd"" 2020-11-03T14:45:24.3631400Z VERBOSE: Target database is: 'db-name' (DataSource: server-name, Provider: System.Data.SqlClient, Origin: Explicit). 2020-11-03T14:45:24.4108063Z System.Data.Entity.Migrations.Design.ToolingException: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. 2020-11-03T14:45:24.4111868Z at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner) 2020-11-03T14:45:24.4118794Z at System.Data.Entity.Migrations.Console.Program.Run() 2020-11-03T14:45:24.4122094Z at System.Data.Entity.Migrations.Console.Program.Main(String[] args) 2020-11-03T14:45:24.4126803Z ERROR: Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. 2020-11-03T14:45:24.4862640Z ##[error]Cmd.exe exited with code '1'. 2020-11-03T14:45:24.5283178Z ##[section]Finishing: Command Line Script
This problem stops when I use SQL Server Authentication, unfortunately I need to use Windows Authentication.