Change SharePoint site URL from the initial domain to a different domain with a PowerShell Script

PowerShell Script

So here’s the scenario.

One of our UK Based MSP partners had signed up with an end customer who had an M365 tenant with a name that wasn’t needed anymore.

We’ll get it straight…

Let’s assume 4 partners together opened up a firm and the domain name was with the initial of all these four people. Out of the four, 2 have withdrawn their stake from the company and so they are now left with a domain name that has the initials of them all. It doesn’t make sense right?

They did change the name of their organization, but a domain name is something that can’t be changed just like that. Especially when a lot of users are already present in the tenant.

They kept on adding users and services in that tenant, and it just made it more difficult to change the domain name. And because of that, it was not possible to delete that tenant and create a new one too.

We got a request from our MSP Client where we were asked if could specifically change the initial domain name for the SharePoint sites.

This scenario could be common for many since companies do undergo rebranding, mergers, acquisitions or a split.

The only point to be noted here is that we can perform this domain change procedure for SharePoint and OneDrive URLs only.

Ensure that the URL is not taken. Make sure it is available.

P.N. As we are white-labelled service providers, we cannot disclose the names of our MSP Clients or their end customers unless they have given us permission to do so. Hence the names we have used for this blog are only for example purposes. These are not real names.

First Step to change Sharepoint site URL:

In our first attempt to rename the added initial domain, we realized that it was not possible to change or modify it as M365 didn’t permit that.

Here’s a step-by-step procedure of how we went ahead with the same.

WARNING: Make sure you’ve carefully read about the SPO Tenant rename and understand its impact on your organization https://aka.ms/SPOTenantRename.

Here’s how we changed the domain name on SharePoint and OneDrive:

Goal: To add the domain name suggested by the end-user

Let’s assume that the end customer name is “LANJABIL”, consisting of the initials of all 4 founders of the organization. The first two founders (L.A. and N.J.) have left, and now we are left with (A.B. and I.L.).

  • We navigated to https://aka.ms/SPORenameAddDomain with the Global administrator account and then some of the PowerShell modules needed to be installed.
    • Install-Module -Name Microsoft.Online.SharePoint.PowerShell
  • Then we will have to connect PowerShell to the SharePoint site with the global administrator account and need to enter the SharePoint site address which needs to change. In our case it is

“LANJABILLimited-admin.sharepoint.com”

  • Connect-SPOService -Url https://lanjabillimited-admin.sharepoint.com
  • Then we require to run the command which will make changes to the default URL and it will change it to the new requested URL
    • Start-SPOTenantRename -DomainName “ABILlimited” -ScheduledDateTime “2022-04-26T21:58:00”
    • Note:- I have already added this domain to the M365 account and have got it verified as well, the scheduled time should be more than 24 hours from your Device time.
  • After that, it will take 24 hours to propagate the changes to all SharePoint sites.
  • I have added a screenshot for the Reference
    • GUI reference in the SharePoint
    • First, it was showing this URL as displayed in the below picture.
change-sharepoint-site-url
  • After Running the PowerShell script and waiting for 24 hours, the new link has appeared
  • PowerShell reference screenshot:-

Points to remember: –

  • This change affects only SharePoint and OneDrive URLs. It doesn’t mean that the name would change in email addresses.
  • If you have set up multi-geo, this feature cannot be enabled for your organization
  • You can only rename your SharePoint domain once every six months
  • Once you change your SharePoint domain you cannot go back to the original name
  • If you have deleted any of the SharePoint sites, it cannot be restored after the change. So before you make the change, ensure to check the sites that you have deleted and if you want to restore any of those.
  • Check if Before changing your domain name, review any sites and OneDrive accounts that have been locked to determine if the lock should be removed

Frequently Asked Questions

How to set up a SharePoint Site?

Visit the SharePoint website and click on +Create Site. Enter the type of site you want to have, give a name to it, edit the site name etc. And voila! You have a SharePoint Site ready. You can only create a site if you have global admin access or if you have the permission to create subsites.

What is a SharePoint Hub Site?

u003cbru003eAs the name suggests, it is a centralised hub that allows an organization to connect and organize different SharePoint sites. A hub where different sites (Could be team-wise, region wise or project wise) are shown at once so that it is easier to discover related content and be able to apply branding and a common site structure across all associated sites, at once.

How do I change a SharePoint site from private to public?

Go to your SharePoint Online Site and then go to the Settings Gear, under that click on Site Info and there you have the Privacy Settings option to make your site public or private.

How to backup a SharePoint site?

Go to SharePoint, and choose the site you want to take the backup of, go to Documents and then click on the u003cstrongu003eSync.u003c/strongu003e When you click on sync, the documents get saved to your OneDrive and desktop. But with the sync, any change that you make to the SharePoint file, it’ll be reflected on the desktop file as well.

What is a SharePoint Communication Site?

Using a SharePoint Communication Site you can present and broadcast your news, media, reports and their status to others in a visually appealing manner.

Weekly Tech Blogs

We upload blogs on our website every week. So keep an eye on these if you want to get solutions to your tech problems.