Change SharePoint Domain in Microsoft Using PowerShell

Listen to this Post

When your organization undergoes rebranding, mergers, or acquisitions, you may need to change the SharePoint and OneDrive domain URLs from the default `onmicrosoft.com` to a custom domain. Here’s how to achieve this using PowerShell.

Steps to Change SharePoint Domain in Microsoft 365

1. Connect to SharePoint Online via PowerShell

Run the following command to establish a connection:

Connect-SPOService -Url https://yourtenant-admin.sharepoint.com -Credential (Get-Credential)

2. Verify Existing Domains

Check the current SharePoint domains with:

Get-SPOTenant | Select-Object SharePointStartURL

3. Change the Primary Domain

Use the `Set-SPOTenant` cmdlet to update the domain:

Set-SPOTenant -SharePointStartURL "https://yournewdomain.sharepoint.com"

4. Update OneDrive URLs

For OneDrive, execute:

Set-SPOTenant -OneDriveLocation "https://yournewdomain-my.sharepoint.com"

5. Force Domain Update for All Sites

Run the following to apply changes globally:

Get-SPOSite | ForEach-Object { Set-SPOSite -Identity $<em>.Url -Owner $</em>.Owner -StorageQuota $_.StorageQuota }

6. Validate Changes

Confirm the update by checking:

Get-SPOTenant | Select-Object SharePointStartURL, OneDriveLocation

You Should Know:

  • Backup First: Always take a backup before modifying tenant settings.
  • Licensing Requirement: SharePoint Advanced Management may be needed for large-scale changes.
  • DNS Updates: Ensure your custom domain is properly configured in Microsoft 365 DNS settings.
  • User Impact: Users may need to update bookmarks or cached links post-migration.

Expected Output:

After running the commands, verify the new URLs in SharePoint Admin Center and test user access.

What Undercode Say:

Changing a SharePoint domain is irreversible—plan carefully. Use PowerShell automation for consistency. For troubleshooting, check logs via:

Get-SPOAdminLog -StartTime (Get-Date).AddDays(-1) -EndTime (Get-Date)

For hybrid environments, sync changes using Azure AD Connect:

Start-ADSyncSyncCycle -PolicyType Delta

Always test in a staging tenant before production rollout.

Reference: Microsoft Docs – SharePoint Domain Management

Expected Output:

SharePointStartURL OneDriveLocation

https://newdomain.sharepoint.com https://newdomain-my.sharepoint.com 

References:

Reported By: Alitajran Microsoft365 – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

Join Our Cyber World:

💬 Whatsapp | 💬 TelegramFeatured Image