Article ID: 126927, created on Sep 17, 2015, last review on Sep 21, 2015

Symptoms

  • The current version of the Microsoft Office 365 Application is 6.1.
  • An Office 365 subscription is being upgraded from APS 1.2 to APS 2. After running the upgradeAPS1ToAPS2.py script, two orders appear in Service Automation. The first one is an upgrade/downgrade resources order. The second one is a plan switch order. If the first order fails, the second order is processed anyway.

Resolution

To resolve this problem, perform the following actions:

  1. Upgrade the Microsoft Office 365 Application to version 6.2.
  2. Log on to your Office 365 Application End-point Host as Administrator.
  3. Go to the directory where the required Office 365 Gateway Application is placed.
  4. Add the new setting <add key="ORDER_COMPLETION_STATUSES" value="PC,PT,WZ"/> to the file Settings.config. This setting defines order statuses that belong to complete orders. You can modify the value of the setting if it is necessary. For example:

    <appSettings>
      <add key="aspnet:MaxHttpCollectionKeys" value="50000" />
      <add key="aspnet:MaxJsonDeserializerMembers" value="50000" />
      <add key="MOSI_FACTORY" value="O365" />
      <add key="MOSI_Base_URL" value=""/>
      <add key="MOSI_Client_Cert_SubjectName" value=""/>
      <add key="MOSI_Billing_ID" value=""/>
      <add key="MOSI_Communications_Disabled" value="false"/>
      <add key="SERVICE_PROVIDER_TYPE" value="Mosi"/>
      <add key="SMTP_EnableSsl" value="true"/>
      <add key="PS_AdminPassword" value=""/>
      <add key="VIRAL_SKUs" value="POWER_BI_STANDARD"/>
      <add key="ORDER_COMPLETION_STATUSES" value="PC,PT,WZ"/>
    </appSettings>
    
  5. Modify the file App_Code\Utils.cs:

    1. Add the new line using Office365.PBA.Model; after the line using Common.Logging;.
    2. Add the new function after the function public static string[] GetViralSKUs():

      public static string[] GetOrderCompletionStatuses()
      {
          const string statusesKey = "ORDER_COMPLETION_STATUSES";
          var statuses = Utils.getConfigurationValue(statusesKey, "");
          var completionStatuses = new List<string> {PBAOrderStatus.COMPLETED};
          var additionalStatuses = statuses.Replace(" ", "")
              .ToUpperInvariant()
              .Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries);
          if (additionalStatuses.Length > 0)
          {
              completionStatuses.AddRange(additionalStatuses);
          }
          return completionStatuses.Distinct().ToArray();
      }
      

      For example:

      public static string[] GetViralSKUs()
      {
                      const string viralSKUsKey = "VIRAL_SKUs";
                      string skus = Utils.getConfigurationValue(viralSKUsKey, "");
                      return skus.Replace(" ", "").Split(new [] {','}, StringSplitOptions.RemoveEmptyEntries);
      }
      
      public static string[] GetOrderCompletionStatuses()
      {
          const string statusesKey = "ORDER_COMPLETION_STATUSES";
          var statuses = Utils.getConfigurationValue(statusesKey, "");
          var completionStatuses = new List<string> {PBAOrderStatus.COMPLETED};
          var additionalStatuses = statuses.Replace(" ", "")
              .ToUpperInvariant()
              .Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries);
          if (additionalStatuses.Length > 0)
          {
              completionStatuses.AddRange(additionalStatuses);
          }
          return completionStatuses.Distinct().ToArray();
      }
      
  6. Modify the file App_Code\pba\Model\PBAOrderStatus.cs. Add the new line new public static readonly string FAILED = "PF"; after the line public static readonly string OPEN = "OP";. For example:

    namespace Office365.PBA.Model
    {
        internal static class PBAOrderStatus
        {
            public static readonly string COMPLETED = "CP";
            public static readonly string CANCELLED = "CL";
            public static readonly string NEW = "NW";
            public static readonly string OPEN = "OP";
            public static readonly string FAILED = "PF";
        }
    }
    
  7. Modify the file App_Code\aps\MigrationsController.cs:

    1. Add the new line using System.Linq; after the line using System.Collections.Generic;.
    2. In the function private ControllerActionResult ProcessUpgradeOrder(Migration mg, Lazy<PBAProcessor> pbaProc), replace

      if (PBAOrderStatus.NEW == pbaOrderStatus)
      {
          pbaProc.Value.OpenOrder(mg.ResourceUpgradeOrderId);
          return GetAcceptedResponse(mg, string.Format("Waiting for Business Automation Resource Upgrade Order #{0} for Subscription #{1}", mg.ResourceUpgradeOrderId, mg.SubscriptionId), 3);
      }
      

      with

      if (PBAOrderStatus.FAILED == pbaOrderStatus)
      {
          LogHelper.Error(string.Format("Migration was not completed because of error: the Business Automation Resource Upgrade Order #{0} has failed.", mg.ResourceUpgradeOrderId));
          throw new ApplicationException(string.Format(
              "The Business Automation Resource Upgrade Order #{0} has failed.", mg.ResourceUpgradeOrderId));
      }
      if (PBAOrderStatus.NEW == pbaOrderStatus)
      {
          pbaProc.Value.OpenOrder(mg.ResourceUpgradeOrderId);
      }
      var orderCompletionStatuses = Utils.GetOrderCompletionStatuses();
      if (!orderCompletionStatuses.Contains(pbaOrderStatus))
      {
          return GetAcceptedResponse(mg, string.Format("Waiting for Business Automation Resource Upgrade Order #{0} for Subscription #{1}.", mg.ResourceUpgradeOrderId, mg.SubscriptionId), 60*5);
      }
      

Email subscription for changes to this article
Save as PDF