* Enable addon migration

* Update readme to include instructions on app registration
This commit is contained in:
harshabacharaju 2023-03-16 10:41:00 -07:00 коммит произвёл GitHub
Родитель 48530d77d4
Коммит ecdae11638
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 42 добавлений и 7 удалений

Просмотреть файл

@ -194,6 +194,8 @@ public record MigrationResult
public bool AddOn { get; init; }
public string BaseSubscriptionId { get; init; } = string.Empty;
public string MigrationStatus { get; init; } = string.Empty;
public bool StartedNewTermInNce { get; init; }

Просмотреть файл

@ -64,7 +64,13 @@ internal class NewCommerceMigrationProvider : INewCommerceMigrationProvider
var inputBaseMigrationRequests = inputMigrationRequests.Where(m => !m.AddOn && m.MigrationEligible);
var inputAddOnMigrationRequests = inputMigrationRequests.Where(m => m.AddOn && m.MigrationEligible);
await Parallel.ForEachAsync(inputBaseMigrationRequests, options, async (migrationRequest, cancellationToken) =>
var baseSubscriptionIds = inputMigrationRequests.Select(b => b.LegacySubscriptionId).ToList();
var addOnsWithoutBase = inputAddOnMigrationRequests.Where(a => !baseSubscriptionIds.Contains(a.BaseSubscriptionId));
var inputMigrationReadyRequests = inputBaseMigrationRequests.Union(addOnsWithoutBase);
await Parallel.ForEachAsync(inputMigrationReadyRequests, options, async (migrationRequest, cancellationToken) =>
{
try
{
@ -135,7 +141,13 @@ internal class NewCommerceMigrationProvider : INewCommerceMigrationProvider
var inputBaseMigrationRequests = inputMigrations.Where(m => !m.AddOn);
var inputAddOnMigrationRequests = inputMigrations.Where(m => m.AddOn);
await Parallel.ForEachAsync(inputBaseMigrationRequests, options, async (migration, cancellationToken) =>
var baseSubscriptionIds = inputBaseMigrationRequests.Select(b => b.LegacySubscriptionId).ToList();
var addOnsWithoutBase = inputAddOnMigrationRequests.Where(a => !baseSubscriptionIds.Contains(a.BaseSubscriptionId));
var inputMigrationRequests = inputBaseMigrationRequests.Union(addOnsWithoutBase);
await Parallel.ForEachAsync(inputMigrationRequests, options, async (migration, cancellationToken) =>
{
try
{
@ -374,9 +386,12 @@ internal class NewCommerceMigrationProvider : INewCommerceMigrationProvider
foreach (var addOnMigrationResponse in newCommerceMigration.AddOnMigrations)
{
var addOnMigrationRequest = addOnMigrationRequests.SingleOrDefault(n => n.LegacySubscriptionId.Equals(addOnMigrationResponse.CurrentSubscriptionId, StringComparison.OrdinalIgnoreCase));
addOnMigrationResponse.Status = newCommerceMigration.Status;
addOnMigrationResponse.Id = newCommerceMigration.Id;
PrepareMigrationResult(addOnMigrationRequest, batchId, addOnMigrationResponse, newCommerceMigrationError, migrationResults);
if (addOnMigrationRequest != null)
{
addOnMigrationResponse.Status = newCommerceMigration.Status;
addOnMigrationResponse.Id = newCommerceMigration.Id;
PrepareMigrationResult(addOnMigrationRequest, batchId, addOnMigrationResponse, newCommerceMigrationError, migrationResults);
}
}
return migrationResults;
@ -405,6 +420,7 @@ internal class NewCommerceMigrationProvider : INewCommerceMigrationProvider
LegacyProductName = migrationRequest.LegacyProductName,
ExpirationDate = migrationRequest.ExpirationDate,
AddOn = migrationRequest.AddOn,
BaseSubscriptionId = migrationRequest.BaseSubscriptionId,
StartedNewTermInNce = migrationRequest.StartNewTermInNce,
NCETermDuration = migrationRequest.Term,
NCEBillingPlan = migrationRequest.BillingPlan,
@ -430,6 +446,7 @@ internal class NewCommerceMigrationProvider : INewCommerceMigrationProvider
LegacyProductName = migrationRequest.LegacyProductName,
ExpirationDate = migrationRequest.ExpirationDate,
AddOn = migrationRequest.AddOn,
BaseSubscriptionId = migrationRequest.BaseSubscriptionId,
MigrationStatus = newCommerceMigration.Status,
StartedNewTermInNce = migrationRequest.StartNewTermInNce,
NCETermDuration = newCommerceMigration.TermDuration,
@ -459,7 +476,7 @@ internal class NewCommerceMigrationProvider : INewCommerceMigrationProvider
if (newCommerceMigrationError != null)
{
result = new MigrationResult
result = migrationResult with
{
PartnerTenantId = migrationResult.PartnerTenantId,
IndirectResellerMpnId = migrationResult.IndirectResellerMpnId,
@ -481,7 +498,7 @@ internal class NewCommerceMigrationProvider : INewCommerceMigrationProvider
if (newCommerceMigration != null)
{
result = new MigrationResult
result = migrationResult with
{
PartnerTenantId = migrationResult.PartnerTenantId,
IndirectResellerMpnId = migrationResult.IndirectResellerMpnId,
@ -500,6 +517,8 @@ internal class NewCommerceMigrationProvider : INewCommerceMigrationProvider
NCESubscriptionId = newCommerceMigration.NewCommerceSubscriptionId,
BatchId = batchId,
MigrationId = newCommerceMigration.Id,
ErrorCode = null,
ErrorReason = string.Empty,
};
}

Просмотреть файл

@ -59,6 +59,20 @@ Note that steps six through nine are only for scheduled migrations.
## Prerequisites
* In order to build and run the BAM tool, .NET 6.0 SDK is required.
* AAD AppId that is onboarded to access Partner Center Apis. The batch migration (BAM) tool is not configured for multitenant apps. When registering the App please use single tenant app.
* Follow the below steps to create an app if not already exists.
1. Login to Partner Center and navigate to Account Settings.
2. Select App Management and then select “Native App” tab.
3. Select “Add new native app” option to onboard / create a new AAD App.
![Partner Center App Management](assets/images/AccountSettings.png "Partner Center App Management")
4. Take note of the newly created App ID.
5. Login to Azure Portal and navigate to Active Directory.
6. Select “App Registrations” and then select “All Applications” and search for the App ID created in step 3.
![AppRegistrations](assets/images/AppRegistrations.png "AppRegistrations")
7. Select the App from the list and then “Authentication”
8. Under “Redirect URIs” ensure the first entry is checked and add a new entry for http://localhost
![App Authentication](assets/images/AppAuthenticationOptions.png "App Authentication")
9. Click “Save”.
## Step-by-step flow of migrating a batch

Двоичные данные
nce-bulk-migration-tool/assets/images/AccountSettings.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 42 KiB

Двоичные данные
nce-bulk-migration-tool/assets/images/AppAuthenticationOptions.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 44 KiB

Двоичные данные
nce-bulk-migration-tool/assets/images/AppRegistrations.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 13 KiB