How to use PowerShell to add sub domain to Office 365 Online Portal

Summary

This article describe a straightforward way to use PowerShell to add sub domain to Office 365 Online Portal

How implement these steps:

1.       Download and install the Microsoft Online Services Module for Windows PowerShell (new version):

Microsoft Online Services Module for Windows PowerShell 32-bit

Microsoft Online Services Module for Windows PowerShell 64-bit

2.       Create a new remote PowerShell connection against the PowerShell endpoint for Office 365:

Import-Module msonline
$cred = Get-Credential
Connect-MsolService -cred $cred
Get-Command *msol*

3.       Add domain to MS Online Services by using below commands:

Set-MSOLContextCredential –MSOLadminCrendentials (get-credential)
Add-MSOLFederatedDomain –DomainName <string>

 

More Information

Install and Configure Windows PowerShell

http://help.outlook.com/en-us/140/cc952756.aspx

Applies To

Microsoft Office 365 for Enterprise