I am looking for the equivalent VBA example for the C# .NET example below that allows connection to a Azure SQL Database using the App Registration method: -
private const string CONNECTION_STRING = "Server=tcp:{AzureSQLServerName}.database.windows.net,1433;Initial Catalog=:{AzureSQLDatabaseName};Persist Security Info=False;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False";
using (var connection = new SqlConnection(CONNECTION_STRING))
{
connection.AccessToken = access_token;
try
{
connection.Open();
}
The issue in VBA using the "CreateObject("ADODB.Connection")" it does not appear to be able to set any before connection arguments to pass the access token to the connection before opening.
Any assistance on this would be appreciated.