You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Please add AAD auth support for Azure SQL Database #7
I cant get it to work because you only accept connection as a string! And I need to get Azure token first and then establish a connection. Please advise if there any options. urgent project!
private async Task<string> GetToken()
{
var ctx = new AuthenticationContext("https://login.microsoftonline.com/xxx");
var result = await ctx.AcquireTokenAsync("https://database.windows.net/", new ClientCredential("xxx", "xxx"));
return result.AccessToken;
}
and then
using (var conn = new SqlConnection("Data Source=tcp:xxx.database.windows.net,1433;Initial Catalog=xxx;"))
{
conn.AccessToken = await GetToken();
return await conn.QueryASync<T>(sql);
}
I'm in need of this feature too! We're using DbUp with Azure SQL. Would love to use AAD or MSIs instead of having to worry about protecting sql credentials
@sungam3r has tersely demonstrated how to use Azure Integrated Security with DbUp.
Let's close this issue?
@nzolotar for reference, there is a method overload of SqlDatabase() that accepts boolean for azure support.
Example
var upgrader =
DeployChanges.To
.SqlDatabase(connectionString,null,true)
.WithScriptsEmbeddedInAssembly(Assembly.GetExecutingAssembly())
.LogToConsole()
.Build();
Activity
sungam3r commentedon Jul 10, 2020
https://github.com/DbUp/DbUp/blob/master/src/dbup-sqlserver/SqlConnectionManager.cs#L46
https://github.com/DbUp/DbUp/blob/master/src/dbup-sqlserver/dbup-sqlserver.csproj#L50
https://github.com/DbUp/DbUp/blob/master/src/dbup-sqlserver/dbup-sqlserver.csproj#L54
TroyWitthoeft commentedon Jul 20, 2020
I'm in need of this feature too! We're using DbUp with Azure SQL. Would love to use AAD or MSIs instead of having to worry about protecting sql credentials@sungam3r has tersely demonstrated how to use Azure Integrated Security with DbUp.
Let's close this issue?
@nzolotar for reference, there is a method overload of
SqlDatabase()that accepts boolean for azure support.Example
Thanks,
holtalanm commentedon Feb 1, 2021
This does not work for Azure AD when on Azure Gov.
the url for getting the token that is hard-coded is incorrect here ("https://database.windows.net/"). Is there a way to make this configurable?
For the record, for Azure AD on Azure Gov, the url should be: "https://database.usgovcloudapi.net"
sungam3r commentedon Aug 21, 2023
My links from #7 point to nowhere... I don't remember what I wanted to show.
mcolebiltd commentedon Apr 12, 2024
Base url for updated links:
https://github.com/DbUp/dbup-sqlserver/tree/main/src/dbup-sqlserver
droyad commentedon Jul 26, 2024
@holtalanm in v5 there is an overload that lets you set the resource or azureAdInstance when using
https://github.com/DbUp/dbup-sqlserver/blob/eab38c7acfdaf96a29babefd50c17d0bd156b940/src/dbup-sqlserver/AzureSqlConnectionManager.cs#L21(I think you want the latter)In v6 (#14) you will be able to pass a
TokenCredentialwhich lets you set your cloud