Microsoft Office 365

“Microsoft Office 365” uses servers that are run by Microsoft. Most routine settings can be checked using a web interface. Many settings can also be changed using the web interface, unless the settings are forcibly synchronized with a server (such as a customer's Active Directory server).

At the time of this writing, this web page does not include a bunch of information about setting up Office 365, but does provide some details about how to interact with it.

End User Web Logins

It seems that all of these websites are valid and related to Office 365. Sometimes, some might work better for some people than others:

Verification

(This is information scoured from reading online, and not necessarily frome xperience to provide lots of specific details.)

Apparently the usual way to verify a domain (e.g., if you have something like *.example.com registered to your name) then you may verify that domain name using DNS. The process involves creating an “MX” DNS record or a “TXT” DNS record, but another option may be using a “CNAME” DNS record that has ms########.example.com point to ps.microsoftonline.com (as described by TechNibble.com posting: Office 365 verification).

Supporting multiple E-Mail addresses for one account

As I recall, this can be done using a command line. For now, though, here are some GUI instructions:

Puryear-it.com: Add Email Alias (Secondary Email) to Office 365 Account that has AD DirSync suggests using ADSIEdit.msc to modify an AD user account's “ProxyAddresses” field. (Note: that field may be blank by default.) When using ADSIEdit.msc for this, simply place one reference per line:

  • For the default E-Mail address, the reference starts with SMTP in capital letters. (The “default E-Mail address” matters, as it affects the return address of outgoing messages.)
  • For others, the reference starts with smtp in lowercase letters.

After the protocol reference, include a colon and the E-Mail address. e.g.: SMTP:username@example.org or smtp:username@exampleorg.onmicrosoft.com

Then, Puryear-it.com: Add Email Alias (Secondary Email) to Office 365 Account that has AD DirSync says, “you can either wait the default 3 hours that it takes to sync new data to Office 365 or go to your DirSync server and perform a manual sync.”

Perform a manual sync

Perhaps try this, in PowerShell, on the AD server:

start-adsyncsynccycle -policytype initial

The results should report “SUCCESS”. Then, wait a few minutes?

Websites
Administration
portal.office.com
portal.office365.com
Outlook Web Access

https://outlook.office.com/owa/?realm=example.com

Running Exchange Online PowerShell

Using PowerShell, you can connect to a remote Office 365 server and run commands from there.

This information comes from:

TechNet: Connect to Exchange Online PowerShell

The Exchange account will need to allow Exchange Online PowerShell. Since TechNet: Connect to Exchange Online PowerShell mentioned this as a troubleshooting step, this is probably already taken care of by default. (You can probably skip worrying about this.) If this ends up being a problem, check out Enable or disable access to Exchange Online PowerShell.

  1. This needs to not be disabled. The chances of this being an issue may be low, but if this is an issue, it is likely to be a showstopper, so it is good to know about from the get-go. An administrator can remove a user's account from having access to the Administrative Powershell. TechNet: Enable or disable access to Exchange Online PowerShell covers not only disabling access (using $false), but also how to (use $true to) re-enable access if such access had been disabled earler.

    Set-User user@example.com $true
  2. Run PowerShell with UAC-elevation (sometimes called “Run as Administrator” mode, although that does not refer to running as an account named Administrator).
  3. First, before pulling this off, the system will need to be set up to allow running PowerShell scripts. If that hasn't been done yet, then from a UAC-elevated PowerShell prompt, run:

    Set-ExecutionPolicy RemoteSigned

    That changes a system setting, so that won't need to keep being done every time. (On a specific computer, this will typically only need to be done once.)

  4. Gather information:
    • You'll need the Office credentials.
    • Identify which server to connect to. Here are some possible options:

      • https://outlook.office365.com/powershell-liveid/
        • For usage in later sample code, try this:
          $connURI="https://outlook.office365.com/powershell-liveid/"
        • This might be a newer option, so if you're not sure, starting with this might be a good idea.
      • This information might be older? (This information came from TechNet: Connect to Exchange Online PowerShell.)
        • For Office 365 operated by 21Vianet, use the ConnectionUri value: https://partner.outlook.cn/PowerShell
        • For Office 365 Germany, use the ConnectionUri value: https://outlook.outlook.de/powershell-liveid/
    • Get the sign-in “username” (which will look like an E-Mail address) and password that is used for logging into Office 365. That information will be needed momentarily.
  5. Connecting

    Here are a couple of approaches. (Choose one.)

    Using Azure PS plugin

    Note that at the time of this writing, this method has not been tested by the author of this text. However, this method looks like may be simpler (less typing), so it is shown first.

    The exact steps may depend on whether you will be using the first version of the Azure AD plugin, or version two.

    Using version 2 for connecting

    docs.microsoft.com documentation called “Connect to Office 365 PowerShell”, section called “Connect with the Azure Active Directory V2 PowerShell module” seem to suggest this might be as simple as:

    $UserCredential = Get-Credential
    Connect-AzureAD -Credential $UserCredential

    The first of those commands is interactive. Provide the required credentials in the dialog box that comes up.

    Or, for a more interactive approach (which may be needed when using some multi-factor authentication methods)...

    Connect-AzureAD
    Using version 1 to connect

    docs.microsoft.com documentation called “Connect to Office 365 PowerShell”, section called “Connect with the Azure Active Directory V2 PowerShell module” seem to suggest this might be as simple as:

    $UserCredential = Get-Credential
    Connect-MsolService -Credential $UserCredential

    The first of those commands is interactive. Provide the required credentials in the dialog box that comes up.

    Or, for a more interactive approach (which may be needed when using some multi-factor authentication methods)...

    Connect-MsolService
    Another approach
    1. Load the credentials:
      $UserCredential = Get-Credential

      This command is interactive. Provide the required credentials in the dialog box that comes up.

    2. Create the session.

      Here is a sample command (which, at the time of this writing, has been untested). This sample uses the $connURI variable that was set with a step mentioned earlier in this guide.

      (The following command is just one long line of text.)

      $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $connURI -Credential $UserCredential -Authentication Basic -AllowRedirection

      Here's the basic format. (The following command is just one long line of text.)

      $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri ConnectionUriValue -Credential $UserCredential -Authentication Basic -AllowRedirection

      Be sure to use the right value for what the above example calls “ConnectionUriValue”. (This was discussed in the earlier information-gathering step.) e.g.:

      $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://partner.outlook.cn/PowerShell -Credential $UserCredential -Authentication Basic -AllowRedirection
    3. Import sesson:
      Import-PSSession $Session
  6. After the connection is done, the results can be checked:

    Get-PSSession

    (Output should not be blank.)

    (This has been tested using the longer steps involving the Import-PSSession command. The author of this text is believing this may work with the other approaches, as well, so this detail is currently listed outside of the approach-specific text. If this method is found to only work with the approach involving manually starting the Import-PSSession, then this detail may be moved.)

  7. Next, you may want to load an Azure PowerShell Module. (support.office.com document notes that an “Office 365 subscription includes a free subscription to Azure AD so that you can integrate Office 365 with Azure AD if you want to sync passwords or set up single sign-on with your on-premises environment.”

    It does seem like you can load both version two and version 1 of the Azure AD module, so if you're not sure which one you want to use, don't be afraid to just simply load both of them.

    Before utilizing such a module, it might need to be installed first (which can be done using the directinos about to be provided).

    Azure AD V2 PS Module

    Version two of the Azure AD PS Module...

    Using V2

    ...

    If trying to run this didn't work, you might need to try installing it first. (Directions for that are provided next.)

    Installation
    docs.microsoft.com documentation called “Connect to Office 365 PowerShell”, section called “Connect with the Azure Active Directory V2 PowerShell module” provides this simple command:
    Install-Module -Name AzureAD

    (Note: That is an interactive command. The user may be prompted.)

    Azure AD V1 PS Module

    docs.microsoft.com documentation called “Connect to Office 365 PowerShell” contained a Hyperlink redirecting to docs.microsoft.com: PowerShell, “Azure Active Directory (MSOnline)” (docs.microsoft.com: PowerShell, “Azure Active Directory (MSOnline)”).

    Using version 1

    You can try running this.

    Import-Module MSOnline

    If trying to run this didn't work, you might need to try installing it first. (Directions for that are provided next.)

    Installation
    docs.microsoft.com documentation called “Connect to Office 365 PowerShell” provides this simple command:
    Install-Module MSOnline

    (Note: That is an interactive command. The user may be prompted.)

    Using V2
    ...
  8. Be aware that you should disconnect later, so that you don't use up a limited number of sessions. (How to do that is described further, later.) To avoid causing problems in the future, don't just accomplish your current goals and then walk away without performing the proper clean-up.
  9. Perform additional steps for loading modules? (Details are discussed later, after the section about cleaning up a session at the end.)
  10. Perform.

    (Perform what you want to do. After all, this connection was made for a reason, right?)

    e.g.: the following may be a useful (and hopefully quick) test:

    Get-Mailbox
  11. When done with the connection, clean up.

    Here is a warning, quoted directly from Microsoft's page:

    “Be sure to disconnect the remote PowerShell session when you're finished. If you close the Windows PowerShell window without disconnecting the session, you could use up all the remote PowerShell sessions available to you, and you'll need to wait for the sessions to expire. To disconnect the remote PowerShell session, run the following command.”
    Remove-PSSession $Session

Possible further reading/resources (which might have provided some information that has been provided above) include:

Here are some details about additional steps that may be helpful in some circumstances.

Online Services connection to Azure Active Directory
$UserCredential = Get-Credential
Connect-MsolService -Credential $UserCredential
Skype
  1. Skype for Business Online services, Powershell module
    Import-Module LyncOnlineConnector
  2. Skype for Business Powershell
    $lyncSession = New-CsOnlineSession -Credential $UserCredential
  3. Import
    Import-PSSession $lyncSession
SharePoint
Import-PSSession Microsoft.Online.Sharepoint.PowerShell
Connect-SPOService -url https://example-admin.sharepoint.com
Tracking with Office 365

This may also be referred to as “message tracing”.

Using PowerShell

First, ensure you can see the mailboxes. To do that, follow the steps from the “Running Exchange Online PowerShell” section.

Some of the following examples may show how to look at some messages within a specified date range. You can specify date information right in the command line, but the following examples show how to manually set the date as a separate step.

$startDate = set-date -date "07/07/2017 17:17"
$endDate = set-date -date "07/07/2017 19:19"

TechNet: Exchange Online Protection cmdlets Get-MessageTrace may be some helpful/relevant documentation.

This will show who an E-Mail address contacted.

$senderEMailAddress=user@example.com"
Get-MessageTrace -SenderAddress $senderEMailAddress -StartDate $startDate -EndDate $endDate | Select-Object MessageId, Received, SenderAddress, RecipientAddress, Subject, Status, FromIP | Out-GridView

The “Out-GridView” portion of that causes the output to show up in a graphical window. The following example shows a way to show some other message details, and output to a file:

$senderEMailAddress=user@example.com"
Get-MessageTrace -SenderAddress $senderEMailAddress -StartDate $startDate -EndDate $endDate | Select-Object MessageId, Date, Event, Action, Detail, Data | Export-Csv -Path ".\output.csv"

So just what are the fields that can be shown? By replacing the output method with “ FormatList * ” or “ FormatList -Property * ”, we can see the names of various fields that can possibly be output.

This shows a Where usage

$senderEMailAddress=user@example.com"
Get-MessageTrace -SenderAddress $senderEMailAddress -StartDate $startDate -EndDate $endDate | Where {$_.Status -eq "Failed"} Get-MessageTraceDetail | Select-Object MessageId, Date, Event, Action, Detail, Data | Out-GridView

Possible further reading:

https://blogs.technet.microsoft.com/exovoice/2017/09/04/how-to-generate-a- message-trace-with-more-than-5000-lines-in-powershell/

Using a website

This can be done graphically. (This is being written by memory. Hopefully it remains accurate.) Go to the Admin section after logging into Office 365. (Perhaps you actually start there by default.) Then, in left frame, expand the Admin Centers section, and choose Exchange. Then, in a left frame, choose “mail flow”, and choose “message tracing”.

If you choose a custom time frame, and choose a time frame that includes a date that is longer than a week ago, then that may cause some more search options to appear. (Strange...) Also, you may need to wait (hours) for a report to be generated. If time is an important factor, you may be able to get results faster by using the PowerShell approach.

Sadly, it seemed like waiting for such a report provided details that were... wrong! In an actual experience, showing information from two days ago showed over 300 messages being sent in a time period from a couple of days earlier. However, searching for 8 days in order to cause a CSV file to be generated resulted in reports that only showed round 115 messages. The easy way to get that information extracted to a CSV file ended up being to use the PowerShell approach.