public override bool CheckPrereqs(ITaskContext taskContext) { if (!base.CheckPrereqs(taskContext)) { base.Logger.LogInformation(HybridStrings.HybridInfoTaskLogTemplate(base.Name, HybridStrings.HybridInfoBasePrereqsFailed)); return(false); } HybridConfiguration hybridConfigurationObject = taskContext.HybridConfigurationObject; this.onPremOrgRel = taskContext.Parameters.Get <OrganizationRelationship>("_onPremOrgRel"); if (this.onPremOrgRel == null) { throw new LocalizedException(HybridStrings.ErrorOrgRelNotFoundOnPrem); } this.tenantOrgRel = taskContext.Parameters.Get <OrganizationRelationship>("_tenantOrgRel"); if (this.tenantOrgRel == null) { throw new LocalizedException(HybridStrings.ErrorOrgRelNotFoundOnTenant); } if (this.RequiresFederationTrust()) { this.fedOrgId = base.TenantSession.GetFederatedOrganizationIdentifier(); if (this.fedOrgId == null) { throw new LocalizedException(HybridStrings.ErrorFederationIDNotProvisioned); } if (!this.fedOrgId.Enabled || string.IsNullOrEmpty(this.fedOrgId.AccountNamespace.Domain) || this.fedOrgId.Domains.Count == 0) { throw new LocalizedException(HybridStrings.ErrorFederationIDNotProvisioned); } } return(true); }
public override bool Configure(ITaskContext taskContext) { if (!base.Configure(taskContext)) { return(false); } string intraOrganizationConnectorName = this.GetIntraOrganizationConnectorName(); IntraOrganizationConnector intraOrganizationConnector = taskContext.OnPremisesSession.GetIntraOrganizationConnector(intraOrganizationConnectorName); if (intraOrganizationConnector != null) { taskContext.OnPremisesSession.RemoveIntraOrganizationConnector(intraOrganizationConnectorName); } IntraOrganizationConnector intraOrganizationConnector2 = taskContext.TenantSession.GetIntraOrganizationConnector(intraOrganizationConnectorName); if (intraOrganizationConnector2 != null) { taskContext.TenantSession.RemoveIntraOrganizationConnector(intraOrganizationConnectorName); } IntraOrganizationConfiguration intraOrganizationConfiguration = taskContext.OnPremisesSession.GetIntraOrganizationConfiguration(); IntraOrganizationConfiguration intraOrganizationConfiguration2 = taskContext.TenantSession.GetIntraOrganizationConfiguration(); taskContext.OnPremisesSession.NewIntraOrganizationConnector(this.GetIntraOrganizationConnectorName(), intraOrganizationConfiguration2.OnlineDiscoveryEndpoint.ToString(), intraOrganizationConfiguration2.OnlineTargetAddress, true); taskContext.TenantSession.NewIntraOrganizationConnector(this.GetIntraOrganizationConnectorName(), intraOrganizationConfiguration.OnPremiseDiscoveryEndpoint.ToString(), intraOrganizationConfiguration2.OnPremiseTargetAddresses, true); if (!taskContext.Parameters.Get <bool>("_suppressOAuthWarning")) { base.AddLocalizedStringWarning(HybridStrings.WarningOAuthNeedsConfiguration(Configuration.OAuthConfigurationUrl(taskContext.HybridConfigurationObject.ServiceInstance))); } return(true); }
private void ConfigureOnPremisesConnectors() { switch (this.sendConnectorOperation) { case MailFlowTask.Operation.New: this.sendConnector = base.OnPremisesSession.NewSendConnector(this.BuildExpectedSendConnector()); break; case MailFlowTask.Operation.Update: this.sendConnector.UpdateFrom(this.BuildExpectedSendConnector()); base.OnPremisesSession.SetSendConnector(this.sendConnector); break; } if (this.receiveConnectorOperation == MailFlowTask.Operation.Update) { foreach (ADObjectId adobjectId in this.ReceivingTransportServers) { Tuple <MailFlowTask.Operation, IReceiveConnector> tuple = this.receiveConnectorsByTransportServer[adobjectId.Name]; MailFlowTask.Operation item = tuple.Item1; if (item == MailFlowTask.Operation.Update) { IReceiveConnector item2 = tuple.Item2; item2.UpdateFrom(this.BuildExpectedReceiveConnector(adobjectId)); base.OnPremisesSession.SetReceiveConnector(item2); } } foreach (ADObjectId adobjectId2 in this.EdgeTransportServers) { string identity = string.Format("Default Frontend {0}", adobjectId2.ToString()); base.TaskContext.Warnings.Add(HybridStrings.WarningEdgeReceiveConnector(adobjectId2.ToString(), identity, this.TlsCertificateSubjectDomainName.Replace("*", "mail"))); this.edgeReceiveConnectorsWarningDisplayed = true; } } }
private bool CheckCertPrereqs() { if (!Configuration.DisableCertificateChecks) { foreach (ADObjectId adobjectId in this.SendingAndReceivingTransportServers) { IExchangeCertificate exchangeCertificate = base.OnPremisesSession.GetExchangeCertificate(adobjectId.Name, this.TlsCertificateName); if (exchangeCertificate == null) { throw new LocalizedException(HybridStrings.ErrorSecureMailCertificateNotFound(this.HybridConfiguration.TlsCertificateName.CertificateSubject, this.HybridConfiguration.TlsCertificateName.CertificateIssuer, adobjectId.Name)); } if (!exchangeCertificate.Services.ToString().ToUpper().Contains(AllowedServices.SMTP.ToString())) { throw new LocalizedException(HybridStrings.ErrorSecureMailCertificateNoSmtp(adobjectId.Name)); } if (exchangeCertificate.IsSelfSigned) { throw new LocalizedException(HybridStrings.ErrorSecureMailCertificateSelfSigned(adobjectId.Name)); } if (exchangeCertificate.NotBefore > (DateTime)ExDateTime.Now || exchangeCertificate.NotAfter < (DateTime)ExDateTime.Now) { throw new LocalizedException(HybridStrings.ErrorSecureMailCertificateInvalidDate(adobjectId.Name)); } } } return(true); }
public void Connect(PSCredential credentials, CultureInfo sessionUiCulture) { this.CheckDisposed(); try { Dns.GetHostEntry(this.targetServer); } catch (SocketException ex) { throw new CouldNotResolveServerException(this.targetServer, ex, ex); } Uri uri = null; string shellUri = "http://schemas.microsoft.com/powershell/Microsoft.Exchange"; switch (this.connectionType) { case PowershellConnectionType.WSMan: uri = new Uri(string.Format("{0}{1}/wsman", this.useSSL ? "https://" : "http://", this.targetServer)); shellUri = "http://schemas.microsoft.com/powershell/Microsoft.PowerShell"; break; case PowershellConnectionType.OnPrem: this.useSSL = false; uri = new Uri(string.Format("{0}{1}/powershell?serializationLevel=Full", this.useSSL ? "https://" : "http://", this.targetServer)); break; case PowershellConnectionType.Tenant: { string uriString = string.Format("{0}{1}/powershell-liveid?serializationLevel=Full", this.useSSL ? "https://" : "http://", this.targetServer); uri = new Uri(uriString); break; } } WSManConnectionInfo wsmanConnectionInfo = new WSManConnectionInfo(uri, shellUri, credentials); if (this.connectionType == PowershellConnectionType.Tenant) { wsmanConnectionInfo.AuthenticationMechanism = AuthenticationMechanism.Basic; } else if (this.connectionType == PowershellConnectionType.OnPrem) { wsmanConnectionInfo.AuthenticationMechanism = AuthenticationMechanism.Kerberos; } PowershellHostUI hostUI = new PowershellHostUI(); RemotePowershellHost host = new RemotePowershellHost(hostUI); wsmanConnectionInfo.Culture = sessionUiCulture; wsmanConnectionInfo.MaximumConnectionRedirectionCount = 5; this.runspace = RunspaceFactory.CreateRunspace(host, wsmanConnectionInfo); this.logger.LogInformation(HybridStrings.HybridInfoOpeningRunspace(uri.ToString())); try { this.runspace.Open(); } catch (PSRemotingTransportException ex2) { throw new CouldNotOpenRunspaceException(ex2, ex2); } this.openedRunspace = true; }
public override bool CheckPrereqs(ITaskContext taskContext) { if (!base.CheckPrereqs(taskContext)) { base.Logger.LogInformation(HybridStrings.HybridInfoTaskLogTemplate(base.Name, HybridStrings.HybridInfoBasePrereqsFailed)); return(false); } return(true); }
public Collection <PSObject> RunCommand(string cmdlet, SessionParameters parameters, bool ignoreNotFoundErrors) { string data = null; string text = this.BuildCmdletInvocationForLogging(cmdlet, parameters); if (this.shouldInvokePowershellCommand(text)) { this.CheckDisposed(); using (PowerShell powerShell = PowerShell.Create()) { powerShell.Runspace = this.runspace; powerShell.AddCommand(cmdlet); if (parameters != null && parameters.Count > 0) { powerShell.AddParameters(parameters.ToDictionary()); } ExDateTime now = ExDateTime.Now; try { this.logger.LogInformation(HybridStrings.HybridInfoCmdletStart(this.connectionType.ToString(), text, string.Empty)); Collection <PSObject> collection = powerShell.Invoke(); if (powerShell.Streams.Error.Count > 0) { foreach (ErrorRecord errorRecord in powerShell.Streams.Error) { if (!errorRecord.CategoryInfo.Reason.Equals("ManagementObjectNotFoundException") || !ignoreNotFoundErrors) { this.logger.LogError(errorRecord.Exception.ToString()); throw errorRecord.Exception; } } } try { data = RemotePowershellSession.ToText(collection); } catch { data = "?"; } return(collection); } catch (Exception innerException) { Exception ex = new Exception(HybridStrings.ErrorCmdletException(cmdlet).ToString(), innerException); throw ex; } finally { TimeSpan t = ExDateTime.Now.Subtract(now); this.totalProcessedTime += t; this.LogInformationAndData(HybridStrings.HybridInfoCmdletEnd(this.connectionType.ToString(), cmdlet, t.TotalMilliseconds.ToString()), data); } } } return(null); }
public static void Validate(HybridConfiguration dataObject, bool hasErrors, Task.TaskErrorLoggingDelegate writeErrorFunc) { if (hasErrors) { return; } if (dataObject.MaximumSupportedExchangeObjectVersion.ExchangeBuild < dataObject.ExchangeVersion.ExchangeBuild) { writeErrorFunc(new InvalidObjectOperationException(HybridStrings.ErrorHybridConfigurationTooNew(dataObject.ExchangeVersion.ToString(), dataObject.MaximumSupportedExchangeObjectVersion.ToString())), ErrorCategory.InvalidArgument, null); } }
public override bool NeedsConfiguration(ITaskContext taskContext) { taskContext.Logger.LogInformation(HybridStrings.HybridInfoHybridConfigurationObjectVersion(taskContext.HybridConfigurationObject.ExchangeVersion)); taskContext.Logger.LogInformation(HybridStrings.HybridInfoHybridConfigurationEngineVersion(this.currentVersion)); bool flag = base.NeedsConfiguration(taskContext) || (taskContext.HybridConfigurationObject.ExchangeVersion.ExchangeBuild.Major == this.upgradeFrom.ExchangeBuild.Major && this.currentVersion.ExchangeBuild.Major == this.upgradeTo.ExchangeBuild.Major); if (!flag) { taskContext.Logger.LogInformation(HybridStrings.HybridInfoNoNeedToUpgrade); } return(flag); }
public override string ToString() { StringBuilder stringBuilder = new StringBuilder(128); stringBuilder.Append(HybridStrings.ErrorTooManyMatchingResults(this.identity)); stringBuilder.Append(":\r\n"); foreach (string value in this.matches) { stringBuilder.AppendLine(value); } return(stringBuilder.ToString()); }
private IEnumerable <EmailAddressPolicy> GetEmailAddressPoliciesToUpdate(ITaskContext taskContext, bool verifyOnly, IEnumerable <string> hybridDomains, out bool legacyDefaultPolicyNeedsUpgrade) { List <EmailAddressPolicy> list = new List <EmailAddressPolicy>(); legacyDefaultPolicyNeedsUpgrade = false; IEnumerable <EmailAddressPolicy> emailAddressPolicy = base.OnPremisesSession.GetEmailAddressPolicy(); foreach (EmailAddressPolicy emailAddressPolicy2 in emailAddressPolicy) { bool flag = false; bool flag2 = false; foreach (ProxyAddressTemplate proxyAddressTemplate in emailAddressPolicy2.EnabledEmailAddressTemplates) { SmtpProxyAddressTemplate smtpProxyAddressTemplate = proxyAddressTemplate as SmtpProxyAddressTemplate; if (!(smtpProxyAddressTemplate == null)) { string proxyAddressTemplateString = smtpProxyAddressTemplate.ProxyAddressTemplateString; int num = proxyAddressTemplateString.IndexOf("@"); string text = proxyAddressTemplateString.Substring(num + 1); if (text.Equals(this.tenantRoutingDomain, StringComparison.InvariantCultureIgnoreCase)) { flag2 = true; } else if (smtpProxyAddressTemplate.IsPrimaryAddress && hybridDomains.Contains(text, StringComparer.InvariantCultureIgnoreCase)) { flag = true; } } } if (flag && !flag2) { if (emailAddressPolicy2.RecipientFilterType == WellKnownRecipientFilterType.Legacy) { if (emailAddressPolicy2.Name.Equals("default policy", StringComparison.InvariantCultureIgnoreCase)) { legacyDefaultPolicyNeedsUpgrade = true; list.Add(emailAddressPolicy2); } else if (!verifyOnly) { taskContext.Warnings.Add(HybridStrings.WarningHybridLegacyEmailAddressPolicyNotUpgraded(emailAddressPolicy2.Name)); } } else { list.Add(emailAddressPolicy2); } } } return(list); }
public override bool CheckPrereqs(ITaskContext taskContext) { if (!base.CheckPrereqs(taskContext)) { base.Logger.LogInformation(HybridStrings.HybridInfoTaskLogTemplate(base.Name, HybridStrings.HybridInfoBasePrereqsFailed)); return(false); } this.tenantRoutingDomain = taskContext.Parameters.Get <string>("_hybridDomain"); if (string.IsNullOrEmpty(this.tenantRoutingDomain)) { throw new LocalizedException(HybridStrings.ErrorNoHybridDomain); } return(true); }
public object GetPowershellObjectValueOrNull(string command, string identity, string setting) { StringBuilder stringBuilder = new StringBuilder(1024); stringBuilder.Append(HybridStrings.HybridInfoGetObjectValue(setting, identity, command)); this.logger.LogInformation(stringBuilder.ToString()); object result = null; SessionParameters parameters = new SessionParameters(); Dictionary <string, object> powershellUntypedObjectAsMembers = this.GetPowershellUntypedObjectAsMembers(command, identity, parameters); if (!powershellUntypedObjectAsMembers.TryGetValue(setting, out result)) { result = null; } return(result); }
public void Dispose() { if (this.isDisposed) { return; } if (this.runspace != null) { if (this.openedRunspace) { this.runspace.Close(); } this.runspace.Dispose(); this.logger.LogInformation(HybridStrings.HybridInfoTotalCmdletTime(this.connectionType.ToString(), this.totalProcessedTime.TotalSeconds)); } this.isDisposed = true; }
public static void ProcessRecord(ILogger logger, IUserInterface ui, HybridConfiguration hybridConfigurationObject, Func <IOnPremisesSession> createOnPremisesSessionFunc, Func <ITenantSession> createTenantSessionFunc, Action <Exception, ErrorCategory, object> writeErrorFunc, bool forceUpgrade, bool suppressOAuthWarning) { try { using (StandardWorkflow standardWorkflow = new StandardWorkflow(logger, ui, hybridConfigurationObject, createOnPremisesSessionFunc, createTenantSessionFunc)) { standardWorkflow.TaskContext.Parameters.Set <bool>("_forceUpgrade", forceUpgrade); standardWorkflow.TaskContext.Parameters.Set <bool>("_suppressOAuthWarning", suppressOAuthWarning); Engine.Execute(standardWorkflow.TaskContext, standardWorkflow); } } catch (Exception ex) { LocalizedString localizedString = HybridStrings.ExceptionUpdateHybridConfigurationFailedWithLog(ex.ToString(), Environment.MachineName, logger.ToString()); writeErrorFunc(new LocalizedException(localizedString), ErrorCategory.WriteError, null); } }
private static OrganizationRelationship ProvisionOrganizationRelationship(ICommonSession session, OrganizationRelationship existingOrgRel, IFederationInformation federationInfo, IEnumerable <SmtpDomain> domains, string relationshipName) { if (existingOrgRel != null) { session.RemoveOrganizationRelationship(existingOrgRel.Identity.ToString()); } string targetApplicationUri = (federationInfo != null) ? federationInfo.TargetApplicationUri : null; string targetAutodiscoverEpr = (federationInfo != null) ? federationInfo.TargetAutodiscoverEpr : null; session.NewOrganizationRelationship(relationshipName, targetApplicationUri, targetAutodiscoverEpr, domains); existingOrgRel = TaskCommon.GetOrganizationRelationship(session, relationshipName, from d in domains select d.Domain); if (existingOrgRel == null) { throw new LocalizedException(HybridStrings.ErrorOrgRelProvisionFailed(domains.First <SmtpDomain>().ToString())); } return(existingOrgRel); }
private static bool ExecuteSubStep(string subStepName, ITaskContext taskContext, ITask task, Func <ITaskContext, ITask, bool> substep, Func <ITaskContext, ITask, Exception, Exception> createException, bool throwOnFalse) { bool flag = false; Exception ex = null; ExDateTime now = ExDateTime.Now; try { taskContext.Logger.LogInformation(HybridStrings.HybridInfoTaskSubStepStart(task.Name, subStepName)); flag = substep(taskContext, task); if (taskContext.Warnings.Count > 0) { foreach (LocalizedString localizedString in taskContext.Warnings) { taskContext.Logger.LogWarning(localizedString); taskContext.UI.WriteWarning(localizedString); } taskContext.Warnings.Clear(); } if (throwOnFalse && !flag) { ex = createException(taskContext, task, null); } } catch (Exception arg) { ex = createException(taskContext, task, arg); } finally { if (ex != null) { taskContext.Logger.LogError(ex.ToString()); } double totalMilliseconds = ExDateTime.Now.Subtract(now).TotalMilliseconds; taskContext.Logger.LogInformation(HybridStrings.HybridInfoTaskSubStepFinish(task.Name, subStepName, flag, totalMilliseconds)); taskContext.Logger.LogInformation(new string('-', 128)); if (ex != null) { throw ex; } } return(flag); }
private void ValidateUnnecessaryRemoteDomainsAreRemoved(ITaskContext taskContext) { taskContext.Logger.LogInformation(HybridStrings.HybridInfoValidatingUnnecessaryRemoteDomainsAreRemoved); DomainContentConfig domainContentConfig = (from x in taskContext.OnPremisesSession.GetRemoteDomain() where (x.Name ?? string.Empty).StartsWith("Hybrid Domain -") select x).FirstOrDefault <DomainContentConfig>(); if (domainContentConfig != null) { throw new LocalizedException(HybridStrings.ErrorHybridOnPremRemoteDomainNotRemoved(domainContentConfig.Name)); } DomainContentConfig domainContentConfig2 = (from x in taskContext.TenantSession.GetRemoteDomain() where (x.Name ?? string.Empty).StartsWith("Hybrid Domain -") select x).FirstOrDefault <DomainContentConfig>(); if (domainContentConfig2 != null) { throw new LocalizedException(HybridStrings.ErrorHybridTenantRemoteDomainNotRemoved(domainContentConfig2.Name)); } }
public Dictionary <string, object> GetPowershellUntypedObjectAsMembers(string command, string identity, SessionParameters parameters) { if (!string.IsNullOrEmpty(identity)) { parameters.Set("Identity", identity); } List <Dictionary <string, object> > powershellUntypedObjectsAsMembers = this.GetPowershellUntypedObjectsAsMembers(command, identity, parameters); if (powershellUntypedObjectsAsMembers.Count > 1) { List <string> list = new List <string>(powershellUntypedObjectsAsMembers.Count); foreach (Dictionary <string, object> dictionary in powershellUntypedObjectsAsMembers) { string item = (dictionary["Identity"] != null) ? dictionary["Identity"].ToString() : string.Empty; list.Add(item); } throw new TooManyResultsException(identity ?? string.Empty, HybridStrings.ErrorTooManyMatchingResults(identity ?? string.Empty), null, list); } return(powershellUntypedObjectsAsMembers[0]); }
private bool DoOnPremisesReceiveConnectorNeedConfiguration() { this.receiveConnectorOperation = MailFlowTask.Operation.NOP; if (this.ReceivingTransportServers.Count > 0) { using (MultiValuedProperty <ADObjectId> .Enumerator enumerator = this.ReceivingTransportServers.GetEnumerator()) { while (enumerator.MoveNext()) { ADObjectId adobjectId = enumerator.Current; IReceiveConnector obj = this.BuildExpectedReceiveConnector(adobjectId); IReceiveConnector receiveConnector = base.OnPremisesSession.GetReceiveConnector(adobjectId); if (receiveConnector == null) { throw new LocalizedException(HybridStrings.ErrorDefaultReceieveConnectorNotFound(adobjectId.Name)); } Tuple <MailFlowTask.Operation, IReceiveConnector> value; if (receiveConnector.Equals(obj)) { value = new Tuple <MailFlowTask.Operation, IReceiveConnector>(MailFlowTask.Operation.NOP, receiveConnector); } else { this.receiveConnectorOperation = MailFlowTask.Operation.Update; value = new Tuple <MailFlowTask.Operation, IReceiveConnector>(MailFlowTask.Operation.Update, receiveConnector); } this.receiveConnectorsByTransportServer[adobjectId.Name] = value; } goto IL_C2; } } if (this.EdgeTransportServers.Count > 0 && !this.edgeReceiveConnectorsWarningDisplayed) { this.receiveConnectorOperation = MailFlowTask.Operation.Update; } IL_C2: return(this.receiveConnectorOperation != MailFlowTask.Operation.NOP); }
public static MultiValuedProperty <ADObjectId> ValidateServers(ADPropertyDefinition propertyDefinition, IConfigDataProvider session, MultiValuedProperty <ServerIdParameter> servers, HybridConfigurationTaskUtility.GetUniqueObject getServer, Task.TaskErrorLoggingDelegate writeError, params HybridConfigurationTaskUtility.ServerCriterion[] serverCriteria) { MultiValuedProperty <ADObjectId> multiValuedProperty = new MultiValuedProperty <ADObjectId>(false, propertyDefinition, new object[0]); if (servers != null) { foreach (ServerIdParameter serverIdParameter in servers) { if (serverIdParameter != null) { Server server = getServer(serverIdParameter, session, null, new LocalizedString?(Strings.ErrorServerNotFound(serverIdParameter.ToString())), new LocalizedString?(Strings.ErrorServerNotUnique(serverIdParameter.ToString()))) as Server; if (server != null) { if (serverCriteria != null) { foreach (HybridConfigurationTaskUtility.ServerCriterion serverCriterion in serverCriteria) { if (!serverCriterion.DoesMeet(server)) { writeError(new InvalidOperationException(serverCriterion.Error(server.ToString())), ErrorCategory.InvalidOperation, server.ToString()); } } } if (multiValuedProperty.Contains((ADObjectId)server.Identity)) { writeError(new InvalidOperationException(HybridStrings.ErrorHybridServerAlreadyAssigned(server.Identity.ToString())), ErrorCategory.InvalidOperation, server.ToString()); } else { multiValuedProperty.Add(((ADObjectId)server.Identity).DistinguishedName); } } } } } return(multiValuedProperty); }
private ISendConnector GetMatchingSendConnector(string addressSpace) { ISendConnector sendConnector = null; IEnumerable <ISendConnector> enumerable = base.OnPremisesSession.GetSendConnector(); foreach (ISendConnector sendConnector2 in enumerable) { foreach (AddressSpace addressSpace2 in sendConnector2.AddressSpaces) { if (addressSpace2.Address.Equals(addressSpace, StringComparison.InvariantCultureIgnoreCase)) { if (sendConnector != null) { throw new LocalizedException(HybridStrings.ErrorDuplicateSendConnectorAddressSpace(addressSpace)); } if (sendConnector2.AddressSpaces.Count > 1) { throw new LocalizedException(HybridStrings.ErrorSendConnectorAddressSpaceNotExclusive(addressSpace)); } sendConnector = sendConnector2; } } } if (sendConnector == null) { foreach (ISendConnector sendConnector3 in enumerable) { if (string.Equals(sendConnector3.Name, this.DefaultSendConnectorName)) { sendConnector = sendConnector3; break; } } } return(sendConnector); }
public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(HybridStrings.ErrorTaskExceptionTemplate(this.Subtask, this.Message)); if (this.Errors != null && this.Errors.Count <LocalizedString>() > 0) { stringBuilder.AppendLine(); foreach (LocalizedString value in this.Errors) { stringBuilder.AppendLine(value); } } for (Exception innerException = base.InnerException; innerException != null; innerException = innerException.InnerException) { stringBuilder.AppendLine(); stringBuilder.AppendLine(innerException.Message); if (innerException.InnerException == null) { stringBuilder.AppendLine(innerException.StackTrace); } } return(stringBuilder.ToString()); }
public CouldNotResolveServerException(string server, Exception e, Exception innerException) : base(HybridStrings.HybridCouldNotResolveServerException(server, e), innerException) { this.server = server; this.e = e; }
public CouldNotCreateOnPremisesSessionException(Exception e, Exception innerException) : base(HybridStrings.HybridCouldNotCreateOnPremisesSessionException(e), innerException) { this.e = e; }
public CouldNotOpenRunspaceException(Exception e) : base(HybridStrings.HybridCouldNotOpenRunspaceException(e)) { this.e = e; }
public CouldNotOpenRunspaceException(Exception e, Exception innerException) : base(HybridStrings.HybridCouldNotOpenRunspaceException(e), innerException) { this.e = e; }
public LocDescriptionAttribute(HybridStrings.IDs ids) : base(HybridStrings.GetLocalizedString(ids)) { }
public CouldNotCreateTenantSessionException(Exception e) : base(HybridStrings.HybridCouldNotCreateTenantSessionException(e)) { this.e = e; }
private bool CheckTaskPrerequisites(ITaskContext taskContext) { this.Reset(); if (this.RequiresFederationTrust()) { string value = Configuration.SignupDomainSuffix(taskContext.HybridConfigurationObject.ServiceInstance); foreach (AutoDiscoverSmtpDomain autoDiscoverSmtpDomain in this.HybridDomains) { if (!autoDiscoverSmtpDomain.Domain.EndsWith(value, StringComparison.InvariantCultureIgnoreCase) && autoDiscoverSmtpDomain.Domain.Length <= 32) { this.accountNamespace = autoDiscoverSmtpDomain.Domain; break; } } if (string.IsNullOrEmpty(this.accountNamespace)) { base.Logger.LogInformation(HybridStrings.HybridInfoTaskLogTemplate(base.Name, HybridStrings.ErrorAccountNamespace)); base.AddLocalizedStringError(HybridStrings.ErrorAccountNamespace); return(false); } int num = base.OnPremisesSession.GetFederationTrust().Count <IFederationTrust>(); if (num == 0) { base.Logger.LogInformation(HybridStrings.HybridInfoTaskLogTemplate(base.Name, Strings.ErrorFederationTrustNotFound(""))); base.AddLocalizedStringError(HybridStrings.ErrorNoFederationTrustFound); return(false); } if (num > 1) { base.Logger.LogInformation(HybridStrings.HybridInfoTaskLogTemplate(base.Name, HybridStrings.ErrorMultipleFederationTrusts)); base.AddLocalizedStringError(HybridStrings.ErrorMultipleFederationTrusts); return(false); } IFederatedOrganizationIdentifier federatedOrganizationIdentifier = base.OnPremisesSession.GetFederatedOrganizationIdentifier(); if (federatedOrganizationIdentifier == null) { this.updateOnPremisesFedOrgId = true; } else if (federatedOrganizationIdentifier.AccountNamespace == null || string.IsNullOrEmpty(federatedOrganizationIdentifier.AccountNamespace.Domain)) { this.updateOnPremisesFedOrgId = true; } else { if (!federatedOrganizationIdentifier.Enabled) { base.Logger.LogInformation(HybridStrings.HybridInfoTaskLogTemplate(base.Name, HybridStrings.ErrorFederatedIdentifierDisabled)); base.AddLocalizedStringError(HybridStrings.ErrorFederatedIdentifierDisabled); return(false); } this.accountNamespace = federatedOrganizationIdentifier.AccountNamespace.Domain.Replace(FederatedOrganizationId.HybridConfigurationWellKnownSubDomain + ".", string.Empty); if (!string.Equals(TaskCommon.ToStringOrNull(federatedOrganizationIdentifier.DelegationTrustLink), Configuration.FederatedTrustIdentity)) { this.updateOnPremisesFedOrgId = true; } else { this.updateOnPremisesFedOrgId = false; using (IEnumerator <string> enumerator2 = (from d in this.HybridDomains select d.Domain).GetEnumerator()) { while (enumerator2.MoveNext()) { string hybridDomain = enumerator2.Current; if (!federatedOrganizationIdentifier.Domains.Any((FederatedDomain d) => string.Equals(d.Domain.Domain, hybridDomain, StringComparison.InvariantCultureIgnoreCase))) { this.addOnPremisesFedDomains.Add(hybridDomain); } } } } if (!TaskCommon.AreEqual(federatedOrganizationIdentifier.DefaultDomain, this.AutoDiscoverHybridDomain)) { this.updateOnPremisesFedOrgId = true; } } if (this.updateOnPremisesFedOrgId) { foreach (string text in from d in this.HybridDomains select d.Domain) { if (!text.Equals(this.accountNamespace, StringComparison.InvariantCultureIgnoreCase)) { this.addOnPremisesFedDomains.Add(text); } } } IFederatedOrganizationIdentifier federatedOrganizationIdentifier2 = base.TenantSession.GetFederatedOrganizationIdentifier(); string text2 = (federatedOrganizationIdentifier2 != null && federatedOrganizationIdentifier2.DefaultDomain != null) ? federatedOrganizationIdentifier2.DefaultDomain.ToString() : null; if (text2 == null || !text2.Equals(this.TenantCoexistenceDomain, StringComparison.InvariantCultureIgnoreCase)) { this.updateTenantFedOrgId = true; } } return(true); }