Not sure if you have resolved this issue but wanted to provide a suitable answer as it may assist others looking for the same or similar solution. Firstly, in looking at DbUp, I didn't see any native support for Azure AD authentication but I think the following is what you are looking for.
Token-based authentication support for Azure SQL DB using Azure AD auth
The linked Tech Community Blog discusses all the Azure AD methods you can leverage to authenticate with Azure SQL. It contains a sample application (TokenReadme.Zip) demonstrating token based authentication, where the included program.cs
example in the TokenReadme.docx is as follows:
using System;
using System.Data;
using System.Data.SqlClient;
namespace ClinicService
{
class Program
{
static void Main()
{
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
builder["Data Source"] = "aad-managed-demo.database.windows.net"; // replace with your server name
builder["Initial Catalog"] = "demo"; // replace with your database name
builder["Connect Timeout"] = 30;
string accessToken = TokenFactory.GetAccessToken();
if (accessToken == null)
{
Console.WriteLine("Fail to acuire the token to the database.");
}
using (SqlConnection connection = new SqlConnection(builder.ConnectionString))
{
try
{
connection.AccessToken = accessToken;
connection.Open();
Console.WriteLine("Connected to the database");
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
Console.WriteLine("Please press any key to stop");
Console.ReadKey();
}
}
}
You should be able to leverage the TokenReadme example to modify your DbUp .NET Library solution to leverage token based authentication. Regards, Mike