In the first three posts of this mini series, I was writing about my motives for moving from Linux/cPanel/IMAP stack to Office 365, about planning and domain verification, and about migrating the mailboxes.
In this post I will shortly touch the mailbox migration again – I’ll talk about setting up the mail redirection, and then I’ll get to the main topic for today – creating a public web site on Office365, and assigning it a custom domain name, which was previously hosted on the Linux server with cPanel admin interface.
Setting up mail redirection in Exchange Online – Office 365
Mail redirections are common thing with email. You might want your emails being delivered somewhere else beside the main mailbox, either for backup purposes (my motivation), or for any other possible reason.
Unfortunately, this is not that straightforward thing in Office 365 to do (comparing with cPanel admin software, for example), but it is not that difficult, either. It includes some PowerShelling, though.
Open the PowerShell console (as an Administrator, if possible), and then type the command:
$LiveCred = Get-Credential
You will get standard Windows credentials prompt, where you have to enter your Office365 administrative credentials.
After you have entered your credentials, execute following commands:
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic –AllowRedirection
You will get the following confirmation:
After that, execute:
Import-PSSession $Session
You should get the following confirmation:
If you get an error here, then please execute the following command:
Set-ExecutionPolicy RemoteSigned
And then start all over again. This command loosens the execution policy by allowing the Remote Signed. Note that you need to have admin privileges for this.
After this has been done, it’s time to set the actual redirection. Type the following command:
Set-Mailbox -Identity YOURUSERNAME -DeliverToMailboxAndForward $true -ForwardingSMTPAddress EMAIL@TOFORWARD.COM
Of course, replace “YOURUSERNAME” with your Office 365 username, and “EMAIL@TOFORWARD.COM” with real address.
Since I was forwarding my mails to my OUTLOOK.COM account, my redirection command looked like this:
Set-Mailbox -Identity adis -DeliverToMailboxAndForward $true -ForwardingSMTPAddress adisaccount@outlook.com
On the end, let’s release the session with the following command:
Remove-PSSession $Session
Now you can close your PowerShell.
Short check if everything works as expected:
1. Send a mail to the Office 365 account:
2. Check if it has arrived there:
3. And finally check if it has been successfully forwarded.
Now, when this has been done, I wanted to create a new web site for my wife – promise is promise.
Hosting public site with SharePoint Online – Office 365
Remember, when I was adding/verifying domains to Office 365, I needed to choose if I will use that domain for Lync and Exchange, or for SharePoint Online. Both would not work. It is one of drawbacks for Office 365, but, as we will see, not a huge one (there is a simple workaround).
My wife has a subdomain, on our primary domain, where her web site is hosted. Let’s call it “mywifesdomain.progressive.ba” for this purpose. To host her site in SharePoint online with this subdomain, let’s go to the Domains option in Office 365 and add this subdomain:
Remember, root domain “progressive.ba” needs to be verified with Office 365 prior to this.
After this has been done, choose that this domain will be used for SharePoint Online. Exchange and Lync are staying unselected here.
When this is done, click on the “SharePoint Online Administration Center” button, to get to Site Collections management.
Add a new Public Website site collection here.
Enter web site name, select previously created subdomain as the site URL, choose the site language and time zone, and set the site collection administrator (myself in this case).
After you click on OK , SharePoint Online will need some minutes to provision your site.
In the meantime, switch to your cPanel interface, and click on the “Advanced DNS Zone Editor” Icon:
Choose to add a new CNAME record, and enter your subdomain in the Name field (“mywifesdomain.progressive.ba” in my case), 3600 as Time to Live value (1 hour), and, in the CNAME field enter:
XXXXXXX.sharepoint.com
Where “XXXXXXX” is name of your Office 365 subscription, and a host address of your private site collections (intranets). If you are not sure what this is, go to the SharePoint online administration, then Site Collections, and look up the domain of all created private (intranet) site collections. That’s the one.
Now, when you add this CNAME record, go get some coffee, until DNS records are propagated. After you are back, and after you open that subdomain in Internet Explorer, you should see the magic:
Now, you just need to design a site, and to enter the materials. But that’s not a topic for today
By the way, if you are asking yourself how to host the “root” domain here, and not the subdomain, as in my example – nothing stops you to call your subdomain “www.yourdomain.net”. Note the “www” part. And then setup the redirection from your domain to www.yourdomain.net, either through cPanel redirection, or software redirection (JavaScript or server side), or even a CNAME… your choice