<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>JBeck’s Blog</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/jbecks/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/jbecks/feed.xml</link>
    <description>A PFE’s Office 365 &amp;amp; Exchange Online Experience</description>
    <lastBuildDate>Tue, 17 Apr 2018 16:58:26 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Exchange Online and Non-MX Delivery</title>
      <link>https://docs.microsoft.com/archive/blogs/jbecks/exchange-online-and-non-mx-delivery</link>
      <pubDate>Tue, 17 Apr 2018 10:58:26 GMT</pubDate>
      <dc:creator><![CDATA[J.Beckham]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/jbecks/?p=85</guid>
      <description><![CDATA[When first designing Exchange hybrid between their on-premises Exchange infrastructure and their...]]></description>
      <content:encoded><![CDATA[When first designing Exchange hybrid between their on-premises Exchange infrastructure and their Exchange Online tenant, some customers insist that they maintain their current mail flow particularly for mail flow to and from the internet.

A very common pre-hybrid inbound mail flow configuration consists of the organization's MX record pointing to a third-party hygiene service, which delivers the organization's sanitized email directly to one or more public IPs that get NATed to typically either on-premises Edge Transport or Hub Transport servers for delivery to destination recipients (generally mailboxes, groups). In a strictly on-premises environment the mail will be mainly delivered to local, on-premises Exchange recipients. In a hybrid environment with directory objects synchronized between Exchange orgs, recipients could be located in on-premises Exchange or in Exchange Online. If the later, the on-premises servers would route those emails out to the cloud mailboxes via hybrid mail flow setup.

An equally common recommendation for securing inbound mail delivery, is for organizations to also restrict inbound and only allow SMTP (tcp 25) traffic from their third-party hygiene service to the public IPs/NATs of their on-premises Exchange transport servers. However when establishing hybrid mail routing, organizations will also be required to add the range it IP subnets that make up Exchange Online Protection (EOP) to their external firewall to allow inbound mail flow from Exchange Online mailboxes. This is depicted as follows:

<img width="1024" height="636" class="alignnone wp-image-115 size-large" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/04/Basic-Setup-1024x636.png" />

<span style="float: none;background-color: transparent;color: #333333;cursor: text;font-family: Georgia,'Times New Roman','Bitstream Charter',Times,serif;font-size: 16px;font-style: normal;font-variant: normal;font-weight: 400;letter-spacing: normal;line-height: 24px;text-align: left;text-decoration: none;text-indent: 0px">For a detailed account of IP subnets that need to be added to allow inbound mail flow from EOP</span> see "<i>Office 365 URLs and IP Address Ranges</i>" (<a href="https://aka.ms/o365ip">link</a>).

The mail flow works and customers are generally happy with this basic design until they realize that senders (spammers) can bypass their published MX record (and third-party hygiene service) and deliver directly to Exchange Online mailboxes by sending to the "contoso-com.mail.protection.outlook.com". This is also the hostname used if the organization was to point their MX record directly to Exchange Online. In this example, although the organization's MX record is still pointing to a third-party service this record is still available for direct routing to Exchange Online mailboxes. Further since directory synchronization is in place, unmigrated recipients in the on-premises organization that are being synced to the cloud can also receive email directly via direct send to EOP.

This may be acceptable for some organizations who do not rely on mail flowing on-premises first or for those who are planning on moving their MX record to point to EOP anyway. However, this could be more of an issue for organizations that require all of their inbound email flow through a single path for either auditing, tracking, content inspection or even archive/journaling purposes.

An argument could be made for EOP identifying and dealing with the spam that could be coming in directly. However, if the organization followed our advice for configuring EOP when it sits in the inbound mail flow behind another hygiene service, then a lot of functionality in EOP may have been turned down/off.

How do organizations prevent direct delivery to this EOP hostname? There is a solution in which an organization can create an inbound "partner" type connect to restrict delivery only from certain sending IP addresses (RestrictDomainsToIPAddresses:$True, SenderIPAddresses:{&lt;IPAddressList&gt;}) or from systems with a specific TLS certificate (RestrictDomainsToCertificate:$True, TlsSenderCertificateName:&lt;CertSubjectName&gt;) such as the certificate that contains the namespace for hybrid mail flow. This will NDR messages sent directly to EOP unless they come from the on-premises Exchange infrastructure.

However, there is another potential issue if a customer is keen to prevent all non-MX mail flow into their organization. If a spammer is able to determine the public IPs for an org's on-premises Exchange infrastructure, they could setup a new tenant in EOP and create a partner connector to deliver spam directly to the on-premises environment. This is course assumes that the spammer can find out one or more IP addresses but arguably would not be too difficult for many environments. Further, since the firewall is already configured to allow SPTM (tcp 25) traffic from EOP per hybrid requirements, the spam emails would flow in to the on-premises Exchange. Depending on the current state of hybrid and where mailboxes reside, the emails may be delivered to on-prem recipients or for migrated recipients route those out to the cloud mailboxes via hybrid mail flow setup.

<img width="1024" height="636" class="alignnone size-large wp-image-95" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/04/Basic-Setup-2-1024x636.png" />

To continue exploring this, we also need to consider the potential here even outside of the non-MX mail delivery issue. This could potentially be an issue for all hybrid organizations, even if their MX records point to EOP. Inbound connectivity to the organization's on-premises Exchange transport servers is still reachable by any EOP tenant. It really becomes less of an issue as mailboxes are migrated to the service but with our long-term hybrid recommendation, at a minimum it could result in unnecessary resource and bandwidth consumption.

<img width="1024" height="636" class="alignnone size-large wp-image-105" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/04/Basic-Setup-3-1024x636.png" />

There is not really a simple solution for this issue however. One reasonably easy option involves creating an on-premises Exchange Transport Rule (ETR) to look for certain message headers as emails are coming into on-premises Exchange. In a properly setup Exchange hybrid environment, an ETR could be configured to allow only messages with the header "X-MS-Exchange-Organization-AuthAs" set to "Internal" which should be the case for all email coming from the Exchange Online tenant. Alternatively, the "X-MS-Exchange-Organization-AuthSource" header could be used and look for matches to ".prod.outlook.com".

However, this ETR will also apply to all messages submitted to on-premises transport and not just those coming in from Exchange Online. Therefore, devices set to relay emails through on-premises Exchange could get caught by this rule and therefore an exception to this rule would need to be put. The exception could be based off of sender IP address ranges or by using externally-secured receive connectors, the latter of which is not ideal for many organizations.

This ETR should be placed in test mode first though, to detect any potential impact to existing mail flow within the organization. An ETR could be set to generate an incident report first, which would be helpful to determine what messages would be flagged and possibly dropped by an ETR.  Once any mail flow issues have been mitigated, the ETR would be replaced with one that would actually reject mail matching the criteria rather than generate an incident report.]]></content:encoded>
    </item>
    <item>
      <title>My Top 12 Office 365 and Exchange Online Must-Dos</title>
      <link>https://docs.microsoft.com/archive/blogs/jbecks/my-top-12-office-365-and-exchange-online-must-dos</link>
      <pubDate>Fri, 13 Apr 2018 10:27:39 GMT</pubDate>
      <dc:creator><![CDATA[J.Beckham]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/jbecks/?p=75</guid>
      <description><![CDATA[In my role as an Exchange PFE I have worked with a number of customers at various stages in their...]]></description>
      <content:encoded><![CDATA[In my role as an Exchange PFE I have worked with a number of customers at various stages in their journey to Office 365 and Exchange Online. Some organizations jump right in to their Exchange migrations by performing a quick pilot and then start migrating mailboxes, only to find that they would like to enable a feature that is not enabled by default. They then have to decide whether the change to the environment warrants stopping the migration and performing additional analysis/testing or whether their online mailbox users can adapt to some amount of potential change. In order to head off these future changes and decisions, I put together a list of items for consideration <em>before</em> a good number of mailbox migrations are performed.

<strong>My Top <del>10</del> <del>11</del> 12 Office 365 and Exchange Online Must-Dos</strong>
<ol>
 	<li><b>Enforce MFA for Office 365 Global Admin Accounts</b> – Global Admin accounts are tempting, high-value targets for attackers and need to be protected accordingly. Organizations should enforce MFA for all Office 365 Global Admin accounts. While Azure MFA requires licensing (Azure AD Premium or other corresponding bundle), Microsoft offers MFA for free on all admin accounts. Couple this with the Exchange Online PowerShell module that supports MFA for added protection (note: MFA-enabled accounts cannot be setup to run scheduled, which is logical considering no one is typically present to provide a second auth factor). See articles "<i>What is Azure Multi-Factor Authentication?</i>" (<a href="https://go.microsoft.com/fwlink/?LinkId=279979">link</a>) and "<i>How To Get Azure Multi-Factor Authentication</i>" (<a href="https://docs.microsoft.com/en-us/azure/multi-factor-authentication/multi-factor-authentication-versions-plans">link</a>) for additional information.</li>
 	<li><b>Enable Exchange Online and Skype for Business Online Modern Authentication</b> – Disabled for these workloads by default, organizations are encouraged to enable modern authentication for Exchange Online and Skype for Business Online (recommendation is to enable both to prevent extra logon prompts). Keep in mind that this will not disable basic authentication but will enable modern authentication capabilities for supported clients which includes MFA. When modern authentication is enabled for Exchange Online, Outlook 2016 and Outlook 2013 (version 15.0.4753 or later, with a required registry setting) will use modern authentication to log in to Office 365 mailboxes instead of basic authentication. This also enables other authentication features like multi-factor authentication (MFA) using smart cards, certificate-based authentication (CBA) and third-party SAML identity providers. If your organization is using third-party federation service, please check with the vendor to ensure modern authentication is supported.</li>
 	<li><b>Enable Mailbox-level Auditing for All Exchange Online Mailboxes</b> – Sometimes administrators require audit logs for investigative purposes. This is sometimes necessary as a result of a breach but also sometimes to try and determine the actions that led up to a certain outcome (such as a delegate deleting an item out of a delegator's mailbox). Mailbox-level audit actions are only recorded when mailbox auditing is enabled and it is disabled by default. In order to be able to comply with the organization's auditing needs, enable it for all mailboxes and if needed, adjust the auditing config (such as login and all deletes for owner actions). Unfortunately, setting AuditEnabled to True via Set-MailboxPlan is not supported. Therefore, develop a simple maintenance script to enable auditing for all mailboxes.</li>
 	<li><b>Disable Client-Based Auto-Forwarding</b> - Remote domain settings override settings that users might configure in Outlook or OWA.       By default, users are allowed to setup automatic forwarding to any remote domain but auto-forwarding can be easily disabled by updating the default remote domain named Default. Use Exchange Online RPS "Set-RemoteDomain Default -AutoForwardEnabled:$False". This is a global setting and applies to every email sent from within the tenant. For a little more granular control (i.e., to allow overrides) an Exchange Transport Rule can be employed instead (text from securescore.office.com):
<ul>
 	<li>If The Sender is located 'Inside the organization'</li>
 	<li>If The Recipient is located 'Outside the organization'</li>
 	<li>If The message type is 'Auto-Forward'</li>
 	<li>Reject the message with the explanation 'External Mail Forwarding via Client Rules is Not Permitted'</li>
</ul>
</li>
 	<li><b>Update the Default MRM Policy (or Create a New One)</b> – The Default MRM policy in Exchange Online includes a move to archive default policy tag as well as a number of personal tags. Update the policy early if needed or create additional policies if desired. As an aside, I am a proponent of using a couple of additional tags, including "Junk Email" and "Deleted Items" (and sometimes "Sent Items"). Also note that if you create a new retention policy, it will have to be assigned to all current and future mailboxes (see Mailbox Plans below for more information on automating). Use Exchange Online RPS "Set-Mailbox &lt;Mailbox&gt; -RetentionPolicy:&lt;PolicyName&gt;".</li>
 	<li><b>Disable Remote PowerShell for Non-Admin Users</b> - By default, all accounts in Exchange Online are allowed to use Exchange Online PowerShell. Administrators can enable or disable a user’s ability to connect to Exchange Online PowerShell. While a user's capabilities in Exchange Online PowerShell are defined by role based access control (RBAC) and the roles that are assigned to them, it's generally unnecessary and opens up another connectivity method when accounts are compromised. Use Exchange Online RPS "Set-User &lt;Account&gt; -RemotePowerShellEnabled:$True".</li>
 	<li><b>Disable POP3 and IMAP4 (and Other Protocols) on Mailboxes</b> - POP and IMAP are client access protocols not used very often these days, except in the case of application mailboxes. As with the case with many of the client access protocols, they could be utilized to remotely try and guess user credentials. If an organization already requires the use of Outlook mobile app, the ActiveSync protocol can be disabled since the Outlook mobile app uses its own API in combination with REST.  Controls options include changing settings on a per-mailbox level (example: Exchange Online RPS: "Set-CASMailbox &lt;Mailbox&gt; -PopEnabled:$False -ImapEnabled:$False"), Exchange Online Mailbox Plans (see below) and Exchange CARs (see below).</li>
 	<li><b>Standardize Future Mailbox Configurations via Mailbox Plans</b> - Some configurations can be deployed via mailbox plans such as quotas, retention policies, RoleAssignmentPolicy, enablement of certain protocols. See articles "<i>Set-MailboxPlan</i>" (<a href="https://docs.microsoft.com/en-us/powershell/module/exchange/mailboxes/set-mailboxplan?view=exchange-ps">link</a>) and "<i>Set-CASMailboxPlan</i>" (<a href="https://docs.microsoft.com/en-us/powershell/module/exchange/client-access/set-casmailboxplan?view=exchange-ps">link</a>) for additional information.</li>
 	<li><b>Consider Deploying Exchange Client Access Rules (CARs) to Disable Unwanted Mailbox Access Methods</b> - CARs help control access to the organization's email based on client properties or client access requests. CARs are like transport rules for client connections to the Exchange Online organization. While above I mentioned disabling certain features or protocols on a per-mailbox basis (such as PowerShell, POP and IMAP) CARs can be used to disable things more broadly but also allow exceptions. See article "<i>Client Access Rules in Exchange Online</i>" (<a href="https://technet.microsoft.com/en-us/library/mt842508(v=exchg.150).aspx">link</a>) for additional information.</li>
 	<li><b>Enable New OME (Office Message Encryption)</b> - OME makes it easier to share protected emails with anybody—inside or outside of the organization. If your tenant was created after February 2018 OME should already be enabled by default. However, if it was enabled before this date then it is likely not enabled. Note that OME requires E3 licenses or higher. Enabling OME takes a bit more than just toggling the feature on but is documented. See articles "<i>Office 365 Message Encryption FAQ</i>" (<a href="https://support.office.com/en-us/article/Office-365-Message-Encryption-FAQ-0432dce9-d9b6-4e73-8a13-4a932eb0081e">link</a>) and "<i>Set Up New Office 365 Message Encryption Capabilities Built On Top of Azure Information Protection</i>" (<a href="https://support.office.com/en-us/article/set-up-new-office-365-message-encryption-capabilities-built-on-top-of-azure-information-protection-7ff0c040-b25c-4378-9904-b1b50210d00e">link</a>) for additional information.</li>
 	<li><b>Deploy Report Message Outlook Add-in </b><b><i>For All Users</i></b> - This is not the legacy Outlook COM add-in that was deployed via MSI but rather, a new Report Message add-in for Outlook that enables users to easily report misclassified email, whether safe or malicious, to Microsoft for analysis. Microsoft uses these submissions to improve the effectiveness of email protection technologies. You can easily enable the add-in for your entire organization for both OWA and Outlook click-to-run. In order to see what users are doing, organizations can also create a transport rule to copy the messages off to another mailbox for later review. See article "<i>Enable the Report Message Add-In</i>" (<a href="https://support.office.com/en-us/article/Enable-the-Report-Message-add-in-4250c4bc-6102-420b-9e0a-a95064837676">link</a>) for additional information.</li>
 	<li><b>Deploy Office 365 ProPlus Monthly (Used To Be Called Current) Channel to Everyone </b>- Many organizations take a conservative approach to deploying Office to users and often times choose to deploy Semi-Annual (used to be called Deferred) channel to most users. However when doing so, organizations run the risk of having to deal/live with potential issues until the next build release which could be up to 6 months away (now with releases in January and July) since only security updates are address between releases. If an issue is impactful enough, the only workaround organizations have is to move users up to Semi-Annual (Targeted) or to Monthly. This could be on a temporary basis (moved back when the issue is fixed) but this can be time consuming and disruptive for the user who is already dealing with an issue. If the frequency of updates and potential changes is manageable to your users, consider deploying Monthly to the majority of the organization and Semi-Annual as an exception. See article "<i>Overview of Update Channels for Office 365 ProPlus</i>" (<a href="https://docs.microsoft.com/en-us/DeployOffice/overview-of-update-channels-for-office-365-proplus">link</a>) for additional information.</li>
</ol>]]></content:encoded>
    </item>
    <item>
      <title>Office 365 and Exchange Online Restore and Recover Processes for Soft-Deleted Mailboxes</title>
      <link>https://docs.microsoft.com/archive/blogs/jbecks/o365-exo-restore-and-recover-soft-deleted-mailboxes</link>
      <pubDate>Sun, 11 Mar 2018 10:55:43 GMT</pubDate>
      <dc:creator><![CDATA[J.Beckham]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/jbecks/?p=35</guid>
      <description><![CDATA[This article provides background information on and process details for performing Exchange Online...]]></description>
      <content:encoded><![CDATA[This article provides background information on and process details for performing Exchange Online restore and recover operations on soft-deleted mailboxes.

Environment Scenario:
<ul>
 	<li>Organization using Office 365 and Exchange Online</li>
 	<li>Directory synchronization via Azure AD Connect</li>
 	<li>Configured Federated Domain (SSO) with Office 365</li>
 	<li>Test accounts used for this article were unlicensed and therefore, cannot have a hold applied</li>
</ul>
When an employee leaves an organization, at a minimum their on-premises AD user account object should either be deleted or removed from the scope of directory synchronization. The procedure for doing so depends on how the organization's identity lifecycle. The removal of the on-premises AD account will initiate a flow that includes moving the Azure AD user account object into the Azure AD recycle bin and soft-deleting the associated Exchange Online mailbox. By default the Azure AD account and soft-deleted mailbox will remain in Office 365 for 30 days, after which time they will be permanently deleted.

If an organization needs to retain a mailbox for longer than 30 days the mailbox can be made <i>inactive</i> before removing the Azure AD user account object, by placing the mailbox on hold or by applying a retention policy to the mailbox in the Office 365 Security &amp; Compliance Center. (Emphasis: the hold needs to be placed on the mailbox <i>before</i> the Azure AD account deletion.) The contents of an inactive mailbox will be retained for the duration of the hold or the retention period of the Office 365 retention policy applied to it before the mailbox was deleted. An inactive mailbox will not consume a license but will be discoverable via eDiscovery or content search. Inactive mailboxes may be recovered/converted or restored back into normal mailboxes at a later date (more details below). Additional information regarding inactive mailboxes can be found in the articles "<i>Overview of Inactive Mailboxes in Office 365</i>" (<a href="https://support.office.com/en-us/article/Overview-of-inactive-mailboxes-in-Office-365-1fbd74e8-7a60-4157-afe8-fe79f05d2038">link</a>) and "<i>Manage Inactive Mailboxes in Office 365</i>" (<a href="https://support.office.com/en-us/article/Manage-inactive-mailboxes-in-Office-365-296a02bd-ebde-4022-900e-547acf38ddd7">link</a>).

Also note that there is no "inactive" flag or attribute on the mailbox to indicate that it is inactive. There is in fact an -InactiveMailboxOnly switch on the Get-Mailbox cmdlet but it lists <i>all</i> soft-deleted mailboxes and not necessarily those that are inactive due to a hold being placed on them. To find the mailboxes in a tenant that are inactive with a hold, query the WhenSoftDeleted attribute for those that have been soft-deleted for over 30 days. For example:
<pre>PS C:\&gt; Get-Mailbox -InactiveMailboxOnly | ? {$_.WhenSoftDeleted -lt [DateTime]::Now.AddDays(-30)} | ft Name,WhenSoftDeleted

Name               WhenSoftDeleted
----               ---------------
Test32             06/12/17 9:23:07 PM
Test24             06/12/17 9:10:04 PM
Test25             07/19/17 8:56:14 AM</pre>
In the event of an on-premises AD account's accidental deletion (or accidental removal from directory synchronization scope) the basic process for restoration of service is to recover the on-premises AD account from the AD recycle bin (or place it back into sync scope), allow the account to sync back out to Office 365, the Azure AD account will recovered from the Azure AD recycle bin and the Exchange Online mailbox will be activated and reconnected.

Now what happens when an organization wants to provide a soft-deleted mailbox (either via a normal delete within 30 days or one that has been deleted for longer than 30 days but is on hold) to another user? There are two options, <i>restore</i> and <i>recover</i>:
<ul>
 	<li><b>Restore</b> - If another employee takes on the job responsibilities of the departed employee, or if another user needs access to the contents of the inactive mailbox, the contents of the inactive mailbox to an existing mailbox can be <i>restored</i> (or merged). The archive from an inactive mailbox can also restored. After it's restored, the inactive mailbox is preserved and is retained as an inactive mailbox.</li>
 	<li><b>Recover</b> - If the departed employee returns to your organization, or if a new employee is hired to take on the job responsibilities of the departed employee, the contents of the inactive mailbox can be <i>recovered</i>. This method converts the inactive mailbox to a new mailbox that contains the contents of the inactive mailbox. After it's recovered, the inactive mailbox no longer exists.</li>
</ul>
Note that a restore leaves the inactive mailbox in place while a recover converts it to normal mailbox.

An organization will need to decide which to utilize depending on the current circumstances. For example, providing a new employee with all of the email contents of the previous employee's mailbox may be a desirable way of introducing them to the position, in which case <i>recovery</i> could be used. However, perhaps there is pending litigation involving the previous employee and the inactive mailbox must remain unaltered, in which case a <i>restore</i> could be used to copy data into a new mailbox while leaving the old one in place.

There are a few additional considerations when performing a recovery. Per <a href="https://support.office.com/en-us/article/Recover-an-inactive-mailbox-in-Office-365-35d0ecdb-7cb0-44be-ad5c-69df2f8f8b25">https://support.office.com/en-us/article/Recover-an-inactive-mailbox-in-Office-365-35d0ecdb-7cb0-44be-ad5c-69df2f8f8b25</a>, when an inactive mailbox is recovered, the following will occur:
<ul>
 	<li><b>Litigation Hold (if it was enabled for the inactive mailbox) is removed.</b></li>
 	<li><b>In-Place Holds are removed</b>. This means that the inactive mailbox is removed as a source mailbox from any In-Place Hold or In-Place eDiscovery searches.</li>
 	<li>The inactive mailbox is <b>removed from any Office 365 retention policies</b> that where applied to it.</li>
 	<li>The<b> single item recovery period (which is defined by the RetainDeletedItemsFor mailbox property) is set to 30 days</b>. Typically, when a new mailbox is created in Exchange Online, this retention period is set to 14 days. Setting this to the maximum value of 30 days gives you more time to recover any data that's been permanently deleted (or purged) from the inactive mailbox. You can also disable single item recovery or set the single item recovery period back to the default of 14 days.</li>
 	<li><b>Retention hold is enabled</b>, and the retention hold duration is set to 30 days.</li>
</ul>
Given the above, use care when recovering a mailbox that has been inactive for an extended period of time. Upon recovery, even though retention hold is enabled and the processing of a retention policy is suspended for 30 days, a mis-assigned retention policy could remove aged content from the newly-recovered mailbox after 30 days.

The remainder of the article details the procedures for performing a restore and a recover.
<ol>
 	<li>Perform Restore Process to Existing Mailbox</li>
 	<li>Perform Recovery Process to New Mailbox with Soft Match</li>
</ol>
<h2>Perform Restore Process to Existing Mailbox</h2>
In this example, mailbox TestMbx01 has been soft-deleted for less than 30 days. We will perform a restore to new mailbox TestMbx10. The soft-deleted mailbox TestMbx01 will remain in-place and without a hold but will eventually be removed after being soft-deleted for 30 days.

We need to ensure that there is no ambiguity when working with a soft-deleted mailbox so need to obtain the mailbox's Exchange GUID:
<pre>PS C:\&gt; Get-Mailbox testmbx01 -InactiveMailboxOnly | fl Name,DistinguishedName,ExchangeGuid,PrimarySmtpAddress

Name               : TestMbx01
DistinguishedName : CN=TestMbx01,OU=Soft Deleted Objects,OU=jebjeb.onmicrosoft.com,OU=Microsoft Exchange Hosted
                     Organizations,DC=NAMPR15A001,DC=PROD,DC=OUTLOOK,DC=COM
ExchangeGuid       : <span style="color: #3366ff">44d9503c-8b4d-43c6-b60b-951312dd4535
</span>PrimarySmtpAddress : TestMbx01@jebeckham.com</pre>
Once we have the GUID, assign the mailbox object to a variable:
<pre>PS C:\&gt; $InactiveMailbox = Get-Mailbox -InactiveMailboxOnly -Identity <span style="color: #3366ff">44d9503c-8b4d-43c6-b60b-951312dd4535
</span>PS C:\&gt; $InactiveMailbox

Name                     Alias               ServerName       ProhibitSendQuota
----                     -----               ----------       -----------------
TestMbx01                 <span style="color: #3366ff">TestMbx01          </span> sn1pr15mb0207   99 GB (106,300,440,576 bytes)</pre>
Once the inactive mailbox has been identified, perform the actual restore operation. Note that we specify a target mailbox and folder (as to keep things tidy in the target mailbox):
<pre>PS C:\&gt; New-MailboxRestoreRequest -SourceMailbox $InactiveMailbox.DistinguishedName -<span style="color: #3366ff">TargetMailbox</span> TestMbx10@jebeckham.com -<span style="color: #3366ff">TargetRootFolder</span> "TestMbx01-Restore" -AllowLegacyDNMismatch

Name           TargetMailbox Status
----           ------------- ------
MailboxRestore TestMbx10     <span style="color: #3366ff">Queued</span></pre>
The restore request has been queued and we simply need to wait for completion:
<pre>PS C:\&gt; Get-MailboxRestoreRequest

Name           TargetMailbox Status
----           ------------- ------
MailboxRestore TestMbx10     <span style="color: #3366ff">Completed</span></pre>
We can also check the details of the restore request at any time but here, I have checked them at the end:
<pre>PS C:\&gt; Get-MailboxRestoreRequest | fl

RunspaceId       : e42290bf-3ad7-4c19-8f9d-346e8c53d856
SourceDatabase   : NAMPR15DG013-db119
TargetMailbox     : TestMbx10
Name             : MailboxRestore
RequestGuid       : f4e44d33-f92f-4e6b-b8c0-4d7107167763
RequestQueue     : NAMPR15DG098-db101
Flags             : IntraOrg, Pull
BatchName         :
Status           : <span style="color: #3366ff">Completed
</span>Protect           : False
Suspend           : False
Direction         : Pull
RequestStyle     : IntraOrg
OrganizationId   : NAMPR15A001.PROD.OUTLOOK.COM/Microsoft Exchange Hosted Organizations/jebjeb.onmicrosoft.com -
                   NAMPR15A001.PROD.OUTLOOK.COM/ConfigurationUnits/jebjeb.onmicrosoft.com/Configuration
SourceMailboxSize :
WhenChanged       : 03/02/18 10:34:37 AM
WhenCreated       : 03/02/18 10:33:32 AM
WhenChangedUTC   : 03/02/18 4:34:37 PM
WhenCreatedUTC   : 03/02/18 4:33:32 PM
Identity         : TestMbx10\MailboxRestore
IsValid           : True
ObjectState       : New</pre>
Once complete, we can find the complete contents of the old mailbox in the target folder we specified in the target mailbox:

[caption id="attachment_45" align="alignnone" width="801"]<img width="801" height="530" class="wp-image-45" alt="RestoreSuccess" src="https://msdnshared.blob.core.windows.net/media/2018/03/image122-1024x678.png" /> Restore success![/caption]

Just to confirm, the original soft-deleted mailbox still remains after the restore process:
<pre>PS C:\&gt; Get-MsolUser -SearchString <span style="color: #3366ff">testmbx01</span> -ReturnDeletedUsers

UserPrincipalName       DisplayName isLicensed
-----------------       ----------- ----------
TestMbx01@jebeckham.com <span style="color: #3366ff">TestMbx01  </span> False

PS C:\&gt; Get-Mailbox <span style="color: #3366ff">testmbx01</span> -InactiveMailboxOnly

Name                     Alias               ServerName       ProhibitSendQuota
----                     -----               ----------       -----------------
TestMbx01                 <span style="color: #3366ff">TestMbx01          </span> sn1pr15mb0207   99 GB (106,300,440,576 bytes)</pre>
<h2>Perform Recovery Process to New Mailbox with Soft Match</h2>
In this example, mailbox TestMbx02 has been soft-deleted for less than 30 days. We will perform a recover to new mailbox TestMbx20. This will initially be a cloud-only account but will then be soft-matched to an on-premises user account object.

As when performing a restore, we need to ensure that there is no ambiguity when working with a soft-deleted mailbox so need to obtain the mailbox's Exchange GUID:
<pre>PS C:\&gt; Get-Mailbox testmbx02 -InactiveMailboxOnly | FL Name,DistinguishedName,ExchangeGuid,PrimarySmtpAddress

Name               : TestMbx02
DistinguishedName : CN=TestMbx02,OU=Soft Deleted Objects,OU=jebjeb.onmicrosoft.com,OU=Microsoft Exchange Hosted
                     Organizations,DC=NAMPR15A001,DC=PROD,DC=OUTLOOK,DC=COM
ExchangeGuid       : <span style="color: #3366ff">a0f88755-9b5a-4ba6-8508-e91163807a80
</span>PrimarySmtpAddress : TestMbx02@jebeckham.com</pre>
Once we have the GUID, assign the mailbox object to a variable:
<pre>PS C:\&gt; $InactiveMailbox = Get-Mailbox -InactiveMailboxOnly -Identity <span style="color: #3366ff">a0f88755-9b5a-4ba6-8508-e91163807a80
</span>PS C:\&gt; $InactiveMailbox

Name                     Alias               ServerName       ProhibitSendQuota
----                     -----               ----------       -----------------
TestMbx02                 <span style="color: #3366ff">TestMbx02          </span> sn6pr15mb2464   99 GB (106,300,440,576 bytes)</pre>
Once the inactive mailbox has been identified, perform the actual recover operation. Note that we are creating a new cloud-only account to which the inactive mailbox will be recovered:
<pre>PS C:\&gt; New-Mailbox -InactiveMailbox $InactiveMailbox.DistinguishedName -Name TestMbx30 -DisplayName TestMbx30 -MicrosoftOnlineServicesID <span style="color: #3366ff">TestMbx30@jebjeb.onmicrosoft.com</span> -Password (ConvertTo-SecureString -String 'P@ssw0rd' -AsPlainText -Force) -ResetPasswordOnNextLogon $False

WARNING: After you create a new mailbox, you must go to the Office 365 Admin Center and assign the mailbox a license, or it will be disabled after the grace period.

Name                     Alias               ServerName       ProhibitSendQuota
----                     -----               ----------       -----------------
TestMbx30                 TestMbx30           sn6pr15mb2464   99 GB (106,300,440,576 bytes)

WARNING: The inactive mailbox has been recovered. To preserve data until you obtain a valid license, we have enabled Single Item Recovery for 30 days. Additionally we have also enabled Retention Hold for 30 days. Once a valid license has been assigned for this mailbox, you can choose to disable these settings and use Litigation or In-Place Hold instead to preserve data.</pre>
Once complete, we can see the new cloud-only account and mailbox:
<pre>PS C:\&gt; Get-MsolUser -SearchString TestMbx30 | fl UserPrincipalName,DisplayName,isLicensed,ImmutableId

UserPrincipalName : <span style="color: #3366ff">TestMbx30@jebjeb.onmicrosoft.com
</span>DisplayName       : TestMbx30
IsLicensed       : False
<span style="color: #3366ff">ImmutableId      </span> :

PS C:\&gt; Get-Mailbox TestMbx30

Name                     Alias               ServerName       ProhibitSendQuota
----                     -----               ----------       -----------------
TestMbx30                 TestMbx30           sn6pr15mb2464   99 GB (106,300,440,576 bytes)</pre>
Now that the mailbox has been recovered, we can perform a soft-match to an on-premises account which is being synced to Office 365. We start by assigning the primary SMTP address of the cloud-only account to the on-premises AD account:
<pre>[PS] C:\&gt;Set-User testmbx30 -WindowsEmailAddress <span style="color: #3366ff">TestMbx30@jebjeb.onmicrosoft.com</span></pre>
We allow for directory synchronization to complete and check on the account again from Azure AD:
<pre>PS C:\&gt; Get-MsolUser -SearchString TestMbx30 | fl UserPrincipalName,DisplayName,isLicensed,ImmutableId

UserPrincipalName : <span style="color: #3366ff">TestMbx30@jebeckham.com
</span>DisplayName       : TestMbx30
IsLicensed       : False
ImmutableId       : <span style="color: #3366ff">vPjCsGtfC0OPu8TZkcqFXw==</span></pre>
We see that the UPN updated to the on-premises value as well as the ImmutableId attribute was populated.  Once confirmed, we can sign in to the account using the proper UPN and federated domain. We find that the previous inactive mailbox has been recovered (highlighted below is that TestMbx30 is the signed-on account but the previous message was send to TestMbx02):

[caption id="attachment_55" align="alignnone" width="801"]<img width="801" height="530" class="wp-image-55" alt="RecoverSuccess" src="https://msdnshared.blob.core.windows.net/media/2018/03/image123-1024x678.png" /> Recover Success![/caption]
<h2>Sources and Additional Information</h2>
<ul type="disc">
 	<li><span>Delete or Restore User Mailboxes in Exchange Online - </span><a href="https://technet.microsoft.com/en-us/library/dn186233(v=exchg.150).aspx"><span>https://technet.microsoft.com/en-us/library/dn186233(v=exchg.150).aspx</span></a></li>
 	<li><span>Restore An Inactive Mailbox in Office 365 - </span><a href="https://support.office.com/en-us/article/Restore-an-inactive-mailbox-in-Office-365-97e06a7a-ef9a-4ce8-baea-18b9e20449a3"><span>https://support.office.com/en-us/article/Restore-an-inactive-mailbox-in-Office-365-97e06a7a-ef9a-4ce8-baea-18b9e20449a3</span></a></li>
 	<li><span>Recover An Inactive Mailbox in Office 365 - </span><a href="https://support.office.com/en-us/article/Recover-an-inactive-mailbox-in-Office-365-35d0ecdb-7cb0-44be-ad5c-69df2f8f8b25"><span>https://support.office.com/en-us/article/Recover-an-inactive-mailbox-in-Office-365-35d0ecdb-7cb0-44be-ad5c-69df2f8f8b25</span></a></li>
 	<li><span>Overview of Inactive Mailboxes in Office 365 - </span><a href="https://support.office.com/en-us/article/Overview-of-inactive-mailboxes-in-Office-365-1fbd74e8-7a60-4157-afe8-fe79f05d2038"><span>https://support.office.com/en-us/article/Overview-of-inactive-mailboxes-in-Office-365-1fbd74e8-7a60-4157-afe8-fe79f05d2038</span></a></li>
 	<li><span>Manage Inactive Mailboxes in Office 365 - </span><a href="https://support.office.com/en-us/article/Manage-inactive-mailboxes-in-Office-365-296a02bd-ebde-4022-900e-547acf38ddd7"><span>https://support.office.com/en-us/article/Manage-inactive-mailboxes-in-Office-365-296a02bd-ebde-4022-900e-547acf38ddd7</span></a></li>
</ul>]]></content:encoded>
    </item>
    <item>
      <title>Run PowerShell Against Both On-Premises and Cloud Mailboxes</title>
      <link>https://docs.microsoft.com/archive/blogs/jbecks/powershell-against-onprem-and-cloud-mailboxes</link>
      <pubDate>Sat, 05 Aug 2017 08:43:02 GMT</pubDate>
      <dc:creator><![CDATA[J.Beckham]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/jbecks/?p=25</guid>
      <description><![CDATA[In an Exchange hybrid environment, there may times when you want to access both Exchange on-premises...]]></description>
      <content:encoded><![CDATA[In an Exchange hybrid environment, there may times when you want to access both Exchange on-premises and Exchange Online mailbox attributes from within the same PowerShell session.

For example, let's say you want to create a report of all Exchange mailboxes that are on litigation hold, whether the mailbox is still in your on-premises Exchange or has been moved to Exchange Online.  Now, Azure AD Connect does sync some mailbox hold-related attributes from on-premises AD to Azure AD including “<em>msExchLitigationHoldDate</em>”, “<em>msExchLitigationHoldOwner</em>” and “<em>msExchUserHoldPolicies</em>”.  These are synced from on-premises mailbox-enabled users to corresponding Azure AD mail-enabled users.  We could simply query recipient objects in Azure AD (Get-Recipient) where LitigationHoldEnabled is True but that would just be too easy.  :-)

Querying mailboxes in both premises involves open a local Exchange PS session and then opening a remote Exchange Online PS session using the <strong>-Prefix</strong> switch on session import:
<ol>
 	<li>Open an on-premises Exchange PowerShell session</li>
 	<li>Connect Exchange Online remote PS:
<ul>
 	<li>$UserCredential = Get-Credential</li>
 	<li>$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection</li>
 	<li>Import-PSSession $Session <strong>-Prefix O365</strong></li>
</ul>
</li>
 	<li>Get-Mailbox | ft UserPrincipalName,DisplayName,LitigationHoldEnabled | ? {$_.LitigationHoldEnabled -eq $True}</li>
 	<li>Get-O365Mailbox | ft UserPrincipalName,DisplayName,LitigationHoldEnabled | ? {$_.LitigationHoldEnabled -eq $True}</li>
</ol>
As you can see, I have used "O365" as the prefix on the Exchange Online cmdlets to distinguish between the two (you can use anything you’d like).  Steps 3 and 4 simply pull on-premises and Exchange online mailbox data, respectively.  If you wanted to combine the two queries, a simple example would be something like:
<ul>
 	<li>$mbxes = @()</li>
 	<li>$mbxes += get-mailbox | ? {$_.LitigationHoldEnabled -eq $True}</li>
 	<li>$mbxes += get-o365mailbox | ? {$_.LitigationHoldEnabled -eq $True}</li>
</ul>
Now $mbxes holds a complete list of mailbox objects that have litigation hold enabled, both on-premises and in the cloud. There are lots of ways you could combine the data and report on it.  This is just a very simple example and should give good direction on the capabilities.

There are also other uses for the -Prefix option such as when connecting to both Exchange Online and Security &amp; Compliance Center remote PS sessions where there are overlapping cmdlets.]]></content:encoded>
    </item>
  </channel>
</rss>