3. Open the Windows Azure Active Directory Module: search for Azure in your Start menu and click Microsoft Azure Active Directory Module for Windows PowerShell or run C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoExit -Command "Import-Module MSOnline" or start PowerShell console and run Import-Module MSOnline.
4. Connect to your Office 365 subscription by running the following PS cmdlets:
$UserCredential = Get-Credential
Connect-MsolService -Credential $UserCredential
Test the Connection by running an Office 365 cmdlets such as Get-MsolUser
Get-MsolUser | Where-Object -Property UserPrincipalName -Like ‘*[your AD Domain]' | Remove-MsolUser -Force