protected override void InternalProcessRecord() { TaskLogger.LogEnter(); bool advancedHydrateableObjectsSharedEnabled = this.newServicePlanSettings.Organization.AdvancedHydrateableObjectsSharedEnabled; base.InternalCreateSharedConfiguration = (this.oldServicePlanSettings.Organization.ShareableConfigurationEnabled && this.newServicePlanSettings.Organization.ShareableConfigurationEnabled && this.tenantCU.SupportedSharedConfigurations.Count == 0); base.InternalIsSharedConfigServicePlan = this.config.IsSharedConfigurationAllowedForServicePlan(this.newServicePlanSettings); this.monadConnection.RunspaceProxy.SetVariable("TargetServicePlan", this.newServicePlan); this.monadConnection.RunspaceProxy.SetVariable("TargetProgramId", this.targetProgramId); this.monadConnection.RunspaceProxy.SetVariable("TargetOfferId", this.targetOfferId); if (this.tenantCU.ServicePlan == this.newServicePlan) { base.WriteVerbose(Strings.VerboseWillSkipUpdateServicePlan(this.Identity.ToString())); } else if (!ServicePlan.CompareAndCalculateDelta(this.oldServicePlanSettings, this.newServicePlanSettings, this.IsCrossSKUMigration, out this.deltaServicePlanSettings, out this.featuresToApply)) { base.WriteVerbose(Strings.VerboseWillUpgradeServicePlan(this.Identity.ToString(), this.tenantCU.ServicePlan, this.newServicePlan)); if (advancedHydrateableObjectsSharedEnabled) { string text; if (!this.config.TryGetHydratedOfferId(this.targetProgramId, this.targetOfferId, out text)) { text = this.targetOfferId; } SharedConfigurationInfo sharedConfigurationInfo = SharedConfigurationInfo.FromInstalledVersion(this.targetProgramId, text); OrganizationId organizationId = SharedConfiguration.FindOneSharedConfigurationId(sharedConfigurationInfo, this.tenantCU.OrganizationId.PartitionId); if (organizationId == null) { base.WriteError(new SharedConfigurationValidationException(Strings.ErrorSharedConfigurationNotFound(this.targetProgramId, text, sharedConfigurationInfo.CurrentVersion.ToString())), (ErrorCategory)1000, null); } else { this.monadConnection.RunspaceProxy.SetVariable("TargetSharedConfiguration", organizationId.OrganizationalUnit.Name); } } if (ManageServicePlanMigrationBase.MailboxPlanConfigurationChanged(this.deltaServicePlanSettings)) { ManageServicePlanMigrationBase.CopyEnabledMailboxPlanRoleAssignmentFeatures(this.deltaServicePlanSettings, this.newServicePlanSettings); } this.newServicePlanSettings.Name = "new"; base.InternalProcessRecord(); if (this.configOnly) { this.WriteWarning(Strings.WarningUpgradeIsNotComplete(this.UpgradePhase.ToString())); } } else { base.WriteVerbose(Strings.VerboseWillSkipUpdateServicePlan(this.Identity.ToString())); } TaskLogger.LogExit(); }
private static bool ShouldCreateSharedConfiguration(string programId, string offerId, PartitionId partitionId, out ExchangeConfigurationUnit sctConfigUnit) { sctConfigUnit = null; ADDriverContext processADContext = ADSessionSettings.GetProcessADContext(); if (processADContext == null || processADContext.Mode != ContextMode.Setup) { return(true); } SharedConfigurationInfo sci = SharedConfigurationInfo.FromInstalledVersion(programId, offerId); sctConfigUnit = SharedConfiguration.FindOneSharedConfiguration(sci, partitionId); return(sctConfigUnit == null); }
// Token: 0x06001183 RID: 4483 RVA: 0x00054608 File Offset: 0x00052808 internal static string CreateSharedConfigurationName(string programId, string offerId) { SharedConfigurationInfo sharedConfigurationInfo = SharedConfigurationInfo.FromInstalledVersion(programId, offerId); string text = string.Format("{0}{1}{2}_{3}", new object[] { SharedConfiguration.SCTNamePrefix, "-", sharedConfigurationInfo.ToString().ToLower().Replace("_hydrated", null), Guid.NewGuid().ToString().Substring(0, 5) }); if (text.Length > SharedConfiguration.SctNameMaxLength) { text = text.Substring(0, SharedConfiguration.SctNameMaxLength); } return(text); }
internal static string CreateSharedConfigurationName(string programId, string offerId) { SharedConfigurationInfo sharedConfigurationInfo = SharedConfigurationInfo.FromInstalledVersion(programId, offerId); string text = string.Format("{0}{1}{2}{3}{4}", new object[] { SharedConfiguration.SCTNamePrefix, TemplateTenantConfiguration.Separator, sharedConfigurationInfo.ToString().ToLower().Replace("_", "-"), TemplateTenantConfiguration.Separator, Guid.NewGuid().ToString().Substring(0, 5) }); if (text.Length > TemplateTenantConfiguration.maxStubLength) { text = text.Substring(0, TemplateTenantConfiguration.maxStubLength); } return(text + TemplateTenantConfiguration.TopLevelDomain); }
protected override IConfigurable PrepareDataObject() { IConfigurationSession configurationSession = base.DataSession as IConfigurationSession; bool useConfigNC = configurationSession.UseConfigNC; configurationSession.UseConfigNC = false; try { this.ou = (ADOrganizationalUnit)base.GetDataObject <ADOrganizationalUnit>(this.OrganizationalUnit, configurationSession, null, new LocalizedString?(Strings.ErrorOrganizationalUnitNotFound(this.OrganizationalUnit.ToString())), new LocalizedString?(Strings.ErrorOrganizationalUnitNotUnique(this.OrganizationalUnit.ToString()))); this.ouOriginatingServer = this.ou.OriginatingServer; } finally { configurationSession.UseConfigNC = useConfigNC; } ExchangeConfigurationUnit exchangeConfigurationUnit = (ExchangeConfigurationUnit)base.PrepareDataObject(); ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 290, "PrepareDataObject", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\DirectorySetup\\InstallTenantConfigurationContainerTask.cs"); string parentLegacyDN = string.Format(CultureInfo.InvariantCulture, "{0}{1}", new object[] { topologyConfigurationSession.GetAdministrativeGroup().LegacyExchangeDN, this.GetRelativeDNTillConfigurationUnits(exchangeConfigurationUnit.Id) }); exchangeConfigurationUnit.Name = exchangeConfigurationUnit.Id.Rdn.UnescapedName; exchangeConfigurationUnit.LegacyExchangeDN = LegacyDN.GenerateLegacyDN(parentLegacyDN, exchangeConfigurationUnit); exchangeConfigurationUnit.OrganizationStatus = OrganizationStatus.PendingCompletion; if (!string.IsNullOrEmpty(this.ServicePlan)) { exchangeConfigurationUnit.ServicePlan = this.ServicePlan; } if (!string.IsNullOrEmpty(this.ProgramId) && !string.IsNullOrEmpty(this.OfferId)) { exchangeConfigurationUnit.ResellerId = string.Format("{0}.{1}", this.ProgramId, this.OfferId); if (this.CreateSharedConfiguration) { this.DataObject.SharedConfigurationInfo = SharedConfigurationInfo.FromInstalledVersion(this.ProgramId, this.OfferId); } } if (string.IsNullOrEmpty(exchangeConfigurationUnit.ExternalDirectoryOrganizationId)) { exchangeConfigurationUnit.ExternalDirectoryOrganizationId = Guid.NewGuid().ToString(); } return(exchangeConfigurationUnit); }
protected override void InternalValidate() { TaskLogger.LogEnter(); base.InternalValidate(); Exception ex = null; try { if (string.IsNullOrEmpty(this.tenantCU.ServicePlan)) { base.WriteError(new InvalidOperationException(Strings.ErrorServicePlanIsNotSet), (ErrorCategory)1002, null); } if (ServicePlanConfiguration.IsDeprecatedServicePlan(this.tenantCU.ServicePlan)) { base.WriteError(new InvalidOperationException(Strings.ErrorServicePlanIsDeprecated(this.tenantCU.Name, this.tenantCU.ServicePlan, this.tenantCU.ProgramId)), (ErrorCategory)1002, null); } this.servicePlanSettings = ServicePlanConfiguration.GetInstance().GetServicePlanSettings(this.tenantCU.ServicePlan); base.InternalLocalStaticConfigEnabled = !this.servicePlanSettings.Organization.AdvancedHydrateableObjectsSharedEnabled; base.InternalLocalHydrateableConfigEnabled = !this.servicePlanSettings.Organization.CommonHydrateableObjectsSharedEnabled; } catch (ArgumentException ex2) { ex = ex2; } catch (IOException ex3) { ex = ex3; } if (ex != null) { base.WriteError(ex, (ErrorCategory)1000, null); } if (!string.IsNullOrEmpty(this.tenantCU.TargetServicePlan)) { string value = ServicePlanConfiguration.GetInstance().ResolveServicePlanName(this.tenantCU.ProgramId, this.TargetOfferId); if (!this.tenantCU.TargetServicePlan.Equals(value, StringComparison.OrdinalIgnoreCase)) { base.WriteError(new InvalidOperationException(Strings.ErrorOOBUpgradeInProgress(this.tenantCU.ServicePlan, this.tenantCU.TargetServicePlan)), (ErrorCategory)1002, null); } } base.InternalIsSharedConfigServicePlan = ServicePlanConfiguration.GetInstance().IsSharedConfigurationAllowedForServicePlan(this.tenantCU.ProgramId, this.tenantCU.OfferId); if (base.InternalIsSharedConfigServicePlan) { if (this.tenantCU.SharedConfigurationInfo == null) { ITenantConfigurationSession tenantConfigurationSession = DirectorySessionFactory.Default.CreateTenantConfigurationSession(false, ConsistencyMode.PartiallyConsistent, ADSessionSettings.FromAllTenantsObjectId(this.tenantCU.Id), 210, "InternalValidate", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\Deployment\\StartOrganizationUpgradeTask.cs"); Result <ExchangeConfigurationUnit>[] array = tenantConfigurationSession.ReadMultiple <ExchangeConfigurationUnit>(this.tenantCU.SupportedSharedConfigurations.ToArray()); string offerId; if (!ServicePlanConfiguration.GetInstance().TryGetHydratedOfferId(this.tenantCU.ProgramId, this.tenantCU.OfferId, out offerId)) { offerId = this.tenantCU.OfferId; } SharedConfigurationInfo sharedConfigurationInfo = SharedConfigurationInfo.FromInstalledVersion(this.tenantCU.ProgramId, offerId); foreach (Result <ExchangeConfigurationUnit> result in array) { if (result.Data != null) { ExchangeConfigurationUnit data = result.Data; if (data.SharedConfigurationInfo.Equals(sharedConfigurationInfo)) { base.InternalSharedConfigurationId = data.OrganizationId; break; } } } if (base.InternalSharedConfigurationId == null) { base.InternalSharedConfigurationId = SharedConfiguration.FindOneSharedConfigurationId(sharedConfigurationInfo, base.CurrentOrganizationId.PartitionId); } if (base.InternalSharedConfigurationId == null) { base.WriteError(new SharedConfigurationValidationException(Strings.ErrorSharedConfigurationNotFound(this.tenantCU.ProgramId, offerId, sharedConfigurationInfo.CurrentVersion.ToString())), ExchangeErrorCategory.Client, null); } } else { base.WriteError(new SharedConfigurationValidationException(Strings.ErrorSharedConfigurationUpgradeNotSupported), ExchangeErrorCategory.Client, null); } } Exception ex4 = Utils.ValidateTransportRuleRegexesForMigratingTenants(this.tenantCU.OrganizationId); if (ex4 != null) { base.WriteError(new SharedConfigurationValidationException(Strings.ErrorE14TenantRulesNeedUpdateBeforeMigratingToE15(ex4.Message)), ExchangeErrorCategory.Client, null); } TaskLogger.LogExit(); }
protected override void InternalBeginProcessing() { TaskLogger.LogEnter(); if (this.nameWarning != LocalizedString.Empty) { this.WriteWarning(this.nameWarning); } base.InternalBeginProcessing(); if (this.Administrator != null) { OrganizationTaskHelper.ValidateParamString("Administrator", this.Administrator.ToString(), new Task.TaskErrorLoggingDelegate(base.WriteError)); } if (this.AdministratorNetID != null) { OrganizationTaskHelper.ValidateParamString("AdministratorNetID", this.AdministratorNetID.ToString(), new Task.TaskErrorLoggingDelegate(base.WriteError)); } if (this.AdministratorNetID != null && this.Administrator != null && this.Administrator.NetId != null && !this.AdministratorNetID.Equals(this.Administrator.NetId)) { base.WriteError(new RecipientTaskException(Strings.ErrorNetIDValuesDoNotMatch(this.AdministratorNetID.ToString(), this.Administrator.NetId.ToString())), ErrorCategory.InvalidArgument, null); } if (this.AdministratorNetID != null && this.Administrator == null) { this.Administrator = new WindowsLiveId(this.AdministratorNetID.ToString()); } if (base.Fields.IsModified("TenantDirSyncServiceInstance") && !string.IsNullOrEmpty(this.DirSyncServiceInstance) && !ServiceInstanceId.IsValidServiceInstanceId(this.DirSyncServiceInstance)) { base.WriteError(new InvalidServiceInstanceIdException(this.DirSyncServiceInstance), ExchangeErrorCategory.Client, null); } if (this.ServicePlanConfig.IsPilotOffer(this.ProgramId, this.OfferId) && !this.CreateSharedConfiguration) { base.WriteError(new ArgumentException(Strings.ErrorPilotServicePlanCanBeUsedToCreateSharedOrgsOnly(this.ProgramId, this.OfferId)), (ErrorCategory)1000, null); } Exception ex = null; string text = null; if (base.Fields["TenantExternalDirectoryOrganizationId"] == null && !this.CreateSharedConfiguration) { base.Fields["TenantExternalDirectoryOrganizationId"] = Guid.NewGuid(); } try { bool flag = this.ServicePlanConfig.TryGetHydratedOfferId(this.ProgramId, this.OfferId, out text); if (!this.CreateSharedConfiguration && this.Name == null) { base.WriteError(new ArgumentException(Strings.ErrorNameNotSet), (ErrorCategory)1000, null); } this.partition = ((this.AccountPartition != null) ? NewOrganizationTask.ResolvePartitionId(this.AccountPartition, new Task.TaskErrorLoggingDelegate(base.WriteError)) : NewOrganizationTask.ChoosePartition(this.Name, this.CreateSharedConfiguration, new Task.TaskErrorLoggingDelegate(base.WriteError))); if (this.CreateSharedConfiguration && flag) { this.OfferId = text; this.shouldCreateSCT = NewOrganizationTask.ShouldCreateSharedConfiguration(this.ProgramId, this.OfferId, this.partition, out this.sctConfigUnit); } string text2 = this.ServicePlanConfig.ResolveServicePlanName(this.ProgramId, this.OfferId); this.servicePlanSettings = this.ServicePlanConfig.GetServicePlanSettings(text2); bool flag2 = this.ServicePlanConfig.IsTemplateTenantServicePlan(this.servicePlanSettings); if (flag2) { this.shouldCreateSCT = NewOrganizationTask.ShouldCreateTenantTemplate(this.ProgramId, this.OfferId, this.partition, out this.sctConfigUnit); } if (this.CreateSharedConfiguration) { if (!this.shouldCreateSCT) { this.WriteWarning(Strings.WarningSharedConfigurationAlreadyExists(this.ProgramId, this.OfferId)); return; } if (string.IsNullOrEmpty(this.Name)) { this.Name = (flag2 ? TemplateTenantConfiguration.CreateSharedConfigurationName(this.ProgramId, this.OfferId) : SharedConfiguration.CreateSharedConfigurationName(this.ProgramId, this.OfferId)); } if (this.DomainName == null) { this.DomainName = (flag2 ? TemplateTenantConfiguration.CreateSharedConfigurationDomainName(this.Name) : SharedConfiguration.CreateSharedConfigurationDomainName(this.Name)); } } OrganizationTaskHelper.ValidateParamString("Name", this.Name, new Task.TaskErrorLoggingDelegate(base.WriteError), true); ADOrganizationalUnit adorganizationalUnit = new ADOrganizationalUnit(); adorganizationalUnit[ADObjectSchema.Name] = this.Name; base.InternalIsSharedConfigServicePlan = this.ServicePlanConfig.IsSharedConfigurationAllowedForServicePlan(this.servicePlanSettings); if (this.CreateSharedConfiguration && !base.InternalIsSharedConfigServicePlan && !this.ServicePlanConfig.IsHydratedOffer(text2)) { base.WriteError(new SharedConfigurationValidationException(Strings.ErrorServicePlanDoesntAllowSharedConfiguration(this.ProgramId, this.OfferId)), (ErrorCategory)1000, null); } else if (!flag && base.InternalIsSharedConfigServicePlan) { text = this.OfferId; } if (this.CreateSharedConfiguration) { base.InternalCreateSharedConfiguration = true; } else if (!this.CreateSharedConfiguration && base.InternalIsSharedConfigServicePlan) { SharedConfigurationInfo sharedConfigurationInfo = SharedConfigurationInfo.FromInstalledVersion(this.ProgramId, text); base.InternalSharedConfigurationId = SharedConfiguration.FindOneSharedConfigurationId(sharedConfigurationInfo, this.partition); if (base.InternalSharedConfigurationId == null) { base.WriteError(new SharedConfigurationValidationException(Strings.ErrorSharedConfigurationNotFound(this.ProgramId, text, sharedConfigurationInfo.CurrentVersion.ToString())), (ErrorCategory)1000, null); } base.InternalCreateSharedConfiguration = false; } List <ValidationError> list = new List <ValidationError>(); list.AddRange(ServicePlan.ValidateFileSchema(text2)); list.AddRange(this.servicePlanSettings.Validate()); if (list.Count != 0) { ex = new ArgumentException(Strings.ErrorServicePlanInconsistent(text2, this.ProgramId, this.OfferId, ValidationError.CombineErrorDescriptions(list))); } } catch (ArgumentException ex2) { ex = ex2; } catch (IOException ex3) { ex = ex3; } if (ex != null) { base.WriteError(ex, ErrorCategory.InvalidArgument, null); } base.InternalLocalStaticConfigEnabled = (!this.servicePlanSettings.Organization.AdvancedHydrateableObjectsSharedEnabled || this.CreateSharedConfiguration); base.InternalLocalHydrateableConfigEnabled = (!this.servicePlanSettings.Organization.CommonHydrateableObjectsSharedEnabled || this.CreateSharedConfiguration); TaskLogger.LogExit(); }