A Guide to Change SharePoint Domain Name Using PowerShell

A Guide to Change SharePoint Domain Name Using PowerShell

Are you an Office 365 admin, anxious about your old tenant, and want to change SharePoint domain name with the new one? Unfortunately, neither the SharePoint admin center nor any other Office 365 admin centers offer the flexibility to rename your SharePoint domain name in their portals.

However, Microsoft PowerShell has provided a simple way to change the SharePoint Online URL to a custom domain for an Office 365 tenant. Let’s delve into the below information and efficiently change your SharePoint domain name in your Microsoft 365 tenant using PowerShell.

What is the Necessity of SharePoint Domain Name Change?

Office 365 admins may decide to rename the SharePoint domain name to a new one for several reasons. A few of the main situations are listed below.

  • To maintain a consistent domain name across all the company’s platforms and resources, administrators can choose to change the SharePoint Online site URL to their company name.
  • Admins need to update the SharePoint domain name if their organization has undergone a merger or acquisition.
  • Additionally, if they want to improve the Search Engine Optimization of their SharePoint sites, they need to rename the default domain name with the new custom domain.

Check for Custom Domain Name Availability for Your Office 365

To add a custom domain to your Office 365, you need to check for the availability of the custom domain name. This check is necessary for the complete renaming of the SharePoint domain.

Note: You need not have to check and add a custom domain name if you have already done this.

  • If you want your URL to be ‘hello.sharepoint.com’ enter ‘https://hello.sharepoint.com/’ in your browser. If a 404 error (this site can’t be reached) is thrown, that means the URL is available.

404 Error Found

  • You can also check the availability of the new domain by logging into your current domain. If you receive a message stating that your username could not be found in the hello.sharepoint.com directory, this means that the domain has already been reserved. In this case, you have to try a different one.
  • In addition to this, you can check the domain name availability via many online forums.

How to Add Custom Domain Name in Azure AD?

You have to add a new custom domain name in the Microsoft Entra admin center to rename the SharePoint site URL. The custom domain name added in your organization can only be used as a name for the new domain. Follow the below steps to add a custom domain name to your Office 365.

  1. Sign in to the Microsoft Entra admin center with the global administrator account.
  2. Then, Click the ‘Domain names‘ under the Settings tab.
  3. Select ‘Add custom domain. Then enter the full new “onmicrosoft.com” domain in the custom domain name box and select ‘Add domain.

Important: There is no need to purchase the “onmicrosoft.com” domain to add it and it does not require any public DNS registration.

Check for Custom Domain Name

  • After the confirmation message that the “domain was added successfully”, you might see a message that the properties could not be found. Select the message to refresh the domain names.
  • Ensure that the “onmicrosoft.com” domain you have added is present on the list and the status is verified. You can rename the SharePoint site only if the state is verified. Verifying the Custom Domain

Change Your SharePoint Domain Name Using PowerShell

Office 365 admins use SharePoint Online Management Shell, a command-line utility, to interact with SharePoint sites without relying on a graphical user interface. You must install and connect to SharePoint Online PowerShell before renaming the SharePoint tenant name.

Below is the list of processes that can be executed while changing the domain name in SharePoint Online. The process described here changes the domain name for all SharePoint sites. If you wish to only change the URL of a SharePoint site and not the domain name, consider renaming the SharePoint site URL.

Warning: Changing your SharePoint domain name may take several hours to days, depending on how many SharePoint sites and users you have. Also, activities related to regarding SharePoint and OneDrive will get blocked during the name change.

Rename the SharePoint Online Tenant’s Name

To schedule the SharePoint domain name change process, run the following command in PowerShell.

Start-SPOTenantRename -DomainName <DomainName> -ScheduledDateTime <YYYY-MM-DDTHH:MM:SS> 

Where “DomainName” is the part before “sharepoint.com” or “onmicrosoft.com” and “ScheduledDateTime” is at least 24 hours in the future and must not be more than 30 days. The time you enter is determined by the actual date and time settings for the computer you are using.

Note: You will receive emails in the global administrator account when the task is scheduled, started, and completed. Also, changing the SharePoint domain name will also reflect on the URL of OneDrive.


Start-SPOTenantRename -DomainName "hello" -ScheduledDateTime "2023-03-28T15:45:00" 

Rename the SharePoint Tenant’s Name

Advanced Tenant Rename – Prioritize SharePoint Online Site Rename

Previously, SharePoint domain renaming supported organizations with fewer than 10,000 sites. Now, with the SharePoint Advanced Management add-on license, Advanced Tenant Rename supports organizations with over 100,000 total sites. Microsoft plans to make this feature globally available (MC789608) before early May 2024.

The Advanced Tenant Rename also enables admins to prioritize up to 4,000 sites in their organization for early execution within the overall rename process. When the traffic on SPO sites is low, such as on weekends, renaming can be completed without any impact.

Prerequisites for Advanced Tenant Rename in SharePoint Online

Here are what you need to use the Advanced Tenant Rename feature:

  1. SharePoint Advanced Management license for all users in your organization.
  2. Your Microsoft 365 organization must have fewer than 100,000 SPO sites.
  3. Your company should not use the special feature named “Microsoft 365 Multi-Geo” and shouldn’t use government clouds, including GCC, GCC High, and DoD.
  4. Your company shouldn’t use vanity domains (from the earlier MTE offering).

Prioritize SharePoint Site Renames Using PowerShell

Once you’ve scheduled the tenant rename, you can use the PowerShell cmdlets to manage the prioritization. To ensure a OneDrive or SharePoint site is renamed first from the list of sites, you can use the “Set-SPOTenantRenameSitePrioritization” cmdlet.

Set-SPOTenantRenameSitePrioritization -SiteUrl https://contoso.sharepoint.com/sites/projectx

To prioritize a set of sites for early rename execution, create a CSV file with a list of site URLs (limiting to around 4,000 sites) and execute the cmdlet as demonstrated here.

Import-Csv <Path> | ForEach-Object {Set-SPOTenantRenameSitePrioritization -SiteUrl $_.SiteUrl}

Sample CSV File

Prioritize SharePoint Site Renames Using PowerShell - CSV Format

To view the list of currently prioritized SharePoint or OneDrive sites, run the following command.


You can use the “Remove-SPOTenantRenameSitePrioritization” cmdlet to remove prioritization for a site.

Remove-SPOTenantRenameSitePrioritization -SiteUrl https://contoso.sharepoint.com/sites/projectx

Important Points to Remember

Below is the list of points that need to be considered if you want to prioritize SharePoint sites using the Advanced Tenant Rename feature.

  • You can update the list of prioritized sites up to 2 hours before the scheduled start time. Once the rename process begins, you can’t make further changes.
  • If you include all 4,000 sites in one file, executing the cmdlet may take around 4-6 hours. For quicker results, split your list into batches and process them separately.
  • Note that prioritizing a site doesn’t guarantee it will be renamed first. Several factors can affect processing times, and multiple site renames happen simultaneously. However, prioritized sites have a higher chance of being completed earlier.

Get the Status of SharePoint Domain Rename Using PowerShell

After initiating the domain name change, you can check the status of the domain name change. Run the following cmdlet in PowerShell to get the detailed status of the SPO site URL rename.


Get SharePoint Domain Rename Status

Retrieve the Status of Domain Change in SharePoint Online

You can get the current status of the SharePoint tenant URL rename for specific sites if necessary. Execute the below cmdlet with the required parameters such as the State, Identity and ParentOperationId.

The below cmdlet will return the domain rename state of the specific SharePoint site.

Get-SPOSiteRenameState -Identity https://contoso.sharepoint.com/sites/ContosoPage 

Retrieve the Status of Site URL Change in SharePoint Online

Also, you can execute the below to get the status for all the SharePoint sites in your Office 365 tenant.

$tenantRenameJobId = (Get-SPOTenantRenameStatus).RenameJobId  
Get-SPOSiteRenameState -ParentOperationId $tenantRenameJobId 

Get the Status for All the SharePoint Sites

Cancel SharePoint Domain Rename

Admins can revoke or stop the SharePoint site rename process if they decide to have their old domain name in Office 365. The scheduled process cannot be stopped if the work is already in progress. Thus, you can execute the following cmdlet to change your SharePoint domain name.

Stop-SPOTenantRename -Reason <SpecificReason> 

Specify the reason for cancelling the SharePoint domain name change process as a parameter.


Stop-SPOTenantRename -Reason "Restart the SharePoint domain URL changing process" 

Limitations in Changing the SharePoint Domain Name

You must be aware of the limitations of changing SharePoint and OneDrive domain name. The following is the list of restrictions you must keep in mind when performing a SharePoint tenant rename.

  • Site Count Limitations: Organizations with over 10,000 SharePoint sites require SharePoint Advanced Management licenses for all users to enable domain renaming.
  • Special Clouds Usage Restrictions: Your domain name can’t be changed if your organization uses special clouds or government clouds such as GCC, GCC High, DoD, etc.
  • Expiry of Redirection: A redirect to the previous address will expire after one year by the renaming of your SharePoint domain.
  • Need of Support Request for Another Rename: If you need additional tenant rename, you must submit a support request by selecting rename a SharePoint tenant more than once.
  • Restriction with Multi-geo Setup: Organizations with a multi-geo setup do not support the domain name change.
  • Unable to Back to Original Name: Changing your SharePoint domain name back to the original name after renaming is impossible. For example, if you change your SharePoint domain from contoso.sharepoint.com to hello.sharepoint.com, changing it back to contoso.sharepoint.com is not at all possible.

Impacts of Changing SharePoint Domain Name in Office 365

In addition to the limitations, you will get low-level to high-level impacts, as listed below, when you try to change SharePoint domain name in Microsoft 365.

Below are a few significant impacts that can occur after the SharePoint tenant rename. However, many of the impacts can be rectified with the appropriate actions.

  • Sync error with office 365 products.
  • The Quick access links in OneDrive and SharePoint won’t work.
  • Power BI reports using SharePoint connections as a data source won’t work.
  • Add-ins might not function as expected.
  • Any sites that have been deleted can’t be restored after the domain name change.
  • Restoring a site to a previous time before the domain name change isn’t possible, etc.

The full impact of the SharePoint domain name change is not known until the execution of the domain rename.

Streamline SharePoint Online Monitoring with AdminDroid

While monitoring your SharePoint Online sites through the Microsoft 365 admin centers or PowerShell, you have certain limitations within those native M365 reporting tools. Additionally, you may encounter technical challenges and errors in PS scripts that can further compound the monitoring process.

But don’t worry! You can get help with AdminDroid SharePoint Online reporting tool, a user-friendly and AI-powered solution for complex free Office 365 reporting.

With the AdminDroid’s SharePoint Online reports, you can easily access in-depth details on SPO site info, document libraries, site members’ properties, etc., using graphical representation and advanced filters. You can get the following AdminDroid report collections on SharePoint Online with a few clicks.

All SharePoint Sites Collection Report - AdminDroid

Adding a cherry on top, AdminDroid’s SharePoint Online auditing tool provides far-reaching details at your fingertips. It enables you to finely slice and dice the data on SharePoint site usage, tracking every suspicious activity and permission changes in your SharePoint Online. AdminDroid offers an array of following SPO audit report collections on critical SharePoint Online activities.

Moreover, the SharePoint dashboard gallery gives you a glance view with essential details on SharePoint site collections, sites, lists, and document libraries.

Are you still curious about the reasons behind choosing AdminDroid? Here is the explanation for you.

AdminDroid’s SharePoint Online management provides 180+ reports on site permissions, external file sharing, ownerships, group memberships, and more. The extensive collection of reports simplifies the efficient monitoring of SharePoint Online data.

Thus, overall AdminDroid provides 1800+ all-inclusive reports and 30+ dashboards on all Microsoft 365 services for better Office 365 management.

Why are you still waiting? Take the next step and fully explore AdminDroid today!

In Conclusion,
Overall, changing the domain name in SharePoint is a detailed process that requires careful planning and execution. However, by following the above guidelines mentioned in this blog, you can efficiently change the SharePoint Online in your Microsoft 365 tenant. Feel free to reach us in the comments for any assistance.

“Understand the need for changing the SharePoint domain and adhere to the PowerShell instructions”

A Guide to Change SharePoint Domain Name Using PowerShell

by M365 Team time to read: 9 min