Add Schema Compare support for AAD (#853)

* pass AzureAcountToken if there is one

* Addressing comments

* formatting

* more formatting and moving getting connectionstring from constructor to CreateSchemaCompareEndpoint()
This commit is contained in:
Kim Santiago
2019-08-22 14:19:39 -07:00
committed by GitHub
parent 487235b1e9
commit 361287a81b
6 changed files with 21 additions and 17 deletions

View File

@@ -7,6 +7,7 @@ using Microsoft.SqlServer.Dac.Compare;
using Microsoft.SqlServer.Dac.Model;
using Microsoft.SqlTools.ServiceLayer.Connection;
using Microsoft.SqlTools.ServiceLayer.SchemaCompare.Contracts;
using Microsoft.SqlTools.ServiceLayer.Utility;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -107,7 +108,7 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare
}
}
internal static SchemaCompareEndpoint CreateSchemaCompareEndpoint(SchemaCompareEndpointInfo endpointInfo, string connectionString)
internal static SchemaCompareEndpoint CreateSchemaCompareEndpoint(SchemaCompareEndpointInfo endpointInfo, ConnectionInfo connInfo)
{
switch (endpointInfo.EndpointType)
{
@@ -117,7 +118,10 @@ namespace Microsoft.SqlTools.ServiceLayer.SchemaCompare
}
case SchemaCompareEndpointType.Database:
{
return new SchemaCompareDatabaseEndpoint(connectionString);
string connectionString = GetConnectionString(connInfo, endpointInfo.DatabaseName);
return connInfo.ConnectionDetails?.AzureAccountToken != null
? new SchemaCompareDatabaseEndpoint(connectionString, new AccessTokenProvider(connInfo.ConnectionDetails.AzureAccountToken))
: new SchemaCompareDatabaseEndpoint(connectionString);
}
default:
{