diff --git a/Packages.props b/Packages.props
index 34422df8a1..6b0edb4ef8 100644
--- a/Packages.props
+++ b/Packages.props
@@ -27,7 +27,7 @@
-
+
diff --git a/bin/nuget/Microsoft.SqlServer.Migration.Assessment.1.0.20221014.16.nupkg b/bin/nuget/Microsoft.SqlServer.Migration.Assessment.1.0.20221028.23.nupkg
similarity index 72%
rename from bin/nuget/Microsoft.SqlServer.Migration.Assessment.1.0.20221014.16.nupkg
rename to bin/nuget/Microsoft.SqlServer.Migration.Assessment.1.0.20221028.23.nupkg
index 12cce49b7b..8c6a3db09c 100644
Binary files a/bin/nuget/Microsoft.SqlServer.Migration.Assessment.1.0.20221014.16.nupkg and b/bin/nuget/Microsoft.SqlServer.Migration.Assessment.1.0.20221028.23.nupkg differ
diff --git a/src/Microsoft.SqlTools.ServiceLayer/Migration/Contracts/GetSkuRecommendationsRequest.cs b/src/Microsoft.SqlTools.ServiceLayer/Migration/Contracts/GetSkuRecommendationsRequest.cs
index 843c468a89..c691a5795c 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/Migration/Contracts/GetSkuRecommendationsRequest.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/Migration/Contracts/GetSkuRecommendationsRequest.cs
@@ -156,6 +156,20 @@ internal class RecommendationResultSet {
internal string sqlDbReportPath;
internal string sqlMiReportPath;
internal string sqlVmReportPath;
+
+ // Create a new empty RecommendationResultSet
+ internal RecommendationResultSet()
+ {
+ this.sqlDbResults = new List();
+ this.sqlMiResults = new List();
+ this.sqlVmResults = new List();
+ this.sqlDbDurationInMs = -1;
+ this.sqlMiDurationInMs = -1;
+ this.sqlVmDurationInMs = -1;
+ this.sqlDbReportPath = "";
+ this.sqlMiReportPath = "";
+ this.sqlVmReportPath = "";
+ }
}
public class GetSkuRecommendationsRequest
diff --git a/src/Microsoft.SqlTools.ServiceLayer/Migration/Contracts/MigrationAssessmentsRequest.cs b/src/Microsoft.SqlTools.ServiceLayer/Migration/Contracts/MigrationAssessmentsRequest.cs
index 4dccb6b215..808c735a0a 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/Migration/Contracts/MigrationAssessmentsRequest.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/Migration/Contracts/MigrationAssessmentsRequest.cs
@@ -10,8 +10,20 @@ namespace Microsoft.SqlTools.ServiceLayer.Migration.Contracts
{
public class MigrationAssessmentsParams
{
+ ///
+ /// Owner URI
+ ///
public string OwnerUri { get; set; }
+
+ ///
+ /// List of databases to assess
+ ///
public string[] Databases { get; set; }
+
+ ///
+ /// Folder path to XEvents files to be assessed, if applicable. Empty string to disable XEvents assessment.
+ ///
+ public string XEventsFilesFolderPath { get; set; }
}
public class MigrationAssessmentResult
diff --git a/src/Microsoft.SqlTools.ServiceLayer/Migration/MigrationService.cs b/src/Microsoft.SqlTools.ServiceLayer/Migration/MigrationService.cs
index dbcef7c8a5..05cf0cddd8 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/Migration/MigrationService.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/Migration/MigrationService.cs
@@ -39,6 +39,8 @@
using Microsoft.SqlServer.Migration.SkuRecommendation.ElasticStrategy.AzureSqlDatabase;
using Microsoft.SqlServer.Migration.SkuRecommendation.Models;
using Microsoft.SqlServer.Migration.SkuRecommendation.Utils;
+using Microsoft.SqlServer.Migration.Assessment.Common.Models;
+using Microsoft.SqlServer.Migration.Assessment.Common.Utils;
namespace Microsoft.SqlTools.ServiceLayer.Migration
{
@@ -157,7 +159,7 @@ internal async Task HandleMigrationAssessmentsRequest(
connectionStrings.Add(ConnectionService.BuildConnectionString(connInfo.ConnectionDetails));
}
string[] assessmentConnectionStrings = connectionStrings.ToArray();
- var results = await GetAssessmentItems(assessmentConnectionStrings);
+ var results = await GetAssessmentItems(assessmentConnectionStrings, parameters.XEventsFilesFolderPath);
await requestContext.SendResult(results);
}
}
@@ -271,8 +273,26 @@ internal async Task HandleGetSkuRecommendationsRequest(
dbsToInclude: new HashSet(parameters.DatabaseAllowList),
hostRequirements: new SqlServerHostRequirements() { NICCount = 1 });
- RecommendationResultSet baselineResults = GenerateBaselineRecommendations(req, parameters);
- RecommendationResultSet elasticResults = GenerateElasticRecommendations(req, parameters);
+ RecommendationResultSet baselineResults;
+ RecommendationResultSet elasticResults;
+
+ try
+ {
+ baselineResults = GenerateBaselineRecommendations(req, parameters);
+ }
+ catch (Exception e)
+ {
+ baselineResults = new RecommendationResultSet();
+ }
+
+ try
+ {
+ elasticResults = GenerateElasticRecommendations(req, parameters);
+ }
+ catch (Exception e)
+ {
+ elasticResults = new RecommendationResultSet();
+ }
GetSkuRecommendationsResult results = new GetSkuRecommendationsResult
{
@@ -586,11 +606,16 @@ public bool TryGetData(string column, out object value)
}
}
- internal async Task GetAssessmentItems(string[] connectionStrings)
+ internal async Task GetAssessmentItems(string[] connectionStrings, string xEventsFilesFolderPath)
{
SqlAssessmentConfiguration.EnableLocalLogging = true;
SqlAssessmentConfiguration.ReportsAndLogsRootFolderPath = Path.GetDirectoryName(Logger.LogFileFullPath);
- DmaEngine engine = new DmaEngine(connectionStrings);
+
+ SqlConnectionLocator locator = new SqlConnectionLocator();
+ locator.ConnectionStrings.AddRange(connectionStrings);
+ locator.XeventsFilesFolderPath = xEventsFilesFolderPath;
+ DmaEngine engine = new DmaEngine(locator);
+
ISqlMigrationAssessmentModel contextualizedAssessmentResult = await engine.GetTargetAssessmentResultsListWithCheck(System.Threading.CancellationToken.None);
var assessmentReportFileName = String.Format("SqlAssessmentReport-{0}.json", DateTime.UtcNow.ToString("yyyyMMddHH-mmss", CultureInfo.InvariantCulture));
var assessmentReportFullPath = Path.Combine(SqlAssessmentConfiguration.ReportsAndLogsRootFolderPath, assessmentReportFileName);
@@ -715,7 +740,7 @@ internal static List GetEligibleSkuCategories(string target
switch (targetPlatform)
{
case "AzureSqlDatabase":
- // Gen5 BC/GP DB
+ // Gen5 BC/GP/HS DB
eligibleSkuCategories.Add(new AzureSqlSkuPaaSCategory(
AzureSqlTargetPlatform.AzureSqlDatabase,
AzureSqlPurchasingModel.vCore,
@@ -729,16 +754,22 @@ internal static List GetEligibleSkuCategories(string target
AzureSqlPaaSServiceTier.GeneralPurpose,
ComputeTier.Provisioned,
AzureSqlPaaSHardwareType.Gen5));
+ eligibleSkuCategories.Add(new AzureSqlSkuPaaSCategory(
+ AzureSqlTargetPlatform.AzureSqlDatabase,
+ AzureSqlPurchasingModel.vCore,
+ AzureSqlPaaSServiceTier.HyperScale,
+ ComputeTier.Provisioned,
+ AzureSqlPaaSHardwareType.Gen5));
break;
case "AzureSqlManagedInstance":
// Gen5 BC/GP MI
eligibleSkuCategories.Add(new AzureSqlSkuPaaSCategory(
- AzureSqlTargetPlatform.AzureSqlManagedInstance,
- AzureSqlPurchasingModel.vCore,
- AzureSqlPaaSServiceTier.BusinessCritical,
- ComputeTier.Provisioned,
- AzureSqlPaaSHardwareType.Gen5));
+ AzureSqlTargetPlatform.AzureSqlManagedInstance,
+ AzureSqlPurchasingModel.vCore,
+ AzureSqlPaaSServiceTier.BusinessCritical,
+ ComputeTier.Provisioned,
+ AzureSqlPaaSHardwareType.Gen5));
eligibleSkuCategories.Add(new AzureSqlSkuPaaSCategory(
AzureSqlTargetPlatform.AzureSqlManagedInstance,