You might have heard the terms tenant name and domain name in Office 365 and Azure AD. You may feel both are the same, but this is not correct. When you sign up for Office 365, you will be asked for your organization name (i.e., contoso). Based on this organization name, Azure AD service will allocate a “tenant name” and it will also create a default domain for your tenant, the domain name will be the same as your tenant name, but with the suffix domain “.onmicrosoft.com“.
For example, if you have created organization with the name “contoso”, then
Your tenant name is : contoso
Default domain name is : contoso.onmicrosoft.com
You can purchase and add custom domains with different names under this domain, but you can’t change the tenant name.
Why tenant name is important
The tenant name will be used in your SharePoint and OneDrive Site URL.
SharePoint URL : https://tenant_name.sharepoint.com SPO Site URL : https://tenant_name.sharepoint.com/sites/site_name SPO Admin Site URL : https://tenant_name-admin.sharepoint.com/ OneDrive URL : https://tenant_name-my.sharepoint.com/personal/username_domain_com/_layouts/15/onedrive.aspx
So if you planned to use these services, then you have to carefully choose your organization name. For example, if you chose “contoso” as your organization name during Office 365 signup, then contoso will become your “tenant name”. Even if you add custom domain “contosotech.com”, you cannot change tenant name in your SharePoint URL to “contosotech.sharepoint.com”.
How to retrieve your Office 365 tenant name
We can extract the tenant name in different ways (i.e. Graph API, Powershell , from SharePoint and OneDrive URL).
Using Microsoft Graph API:
We can use the following Microsoft Graph API endpoints to find the tenant name from verifiedDomains list.
Get organization endpoint:
1
2
3
|
#Select only verifiedDomains property |
List domains endpoint:
Both endpoints return all the verified domains in your organization. You have to look for the initial domain (“isInitial”: true) from the domains list, the initial domain name is your full tenant domain name and removing the subdomain part “.onmicrosoft.com” will provide the tenant name of your organization.
1
2
3
4
5
6
7
|
{ "capabilities" : "Email, OfficeCommunicationsOnline" , "isDefault" : false, "isInitial" : true, "name" : "contoso.onmicrosoft.com" , "type" : "Managed" } |
From the above result :
Tenant domain name is: “contoso.onmicrosoft.com”
Tenant name is: “contoso”
From OneDrive Site URL:
Open your OneDrive for Business site in a web browser and your browser URL will look like below URL. The first part of the URL before -my.sharepoint is tenant name.
https://tenant_name-my.sharepoint.com/personal/username_domain_com/_layouts/15/onedrive.aspx
From SharePoint Site URL:
Open one of your SharePoint Online site in a web browser and your browser URL will look like below URL. Here the first part of the URL before .sharepoint is tenant name.
https://tenant_name.sharepoint.com/sites/site_name
From License SKU ID using Powershell:
The license SKU names are prefixed with your tenant name, so you can list the available license SKUs by running the Get-MsolAccountSku cmdlet and the first part of the AccountSkuID is the tenantname.
Open Powershell with “Run as administrator” privilege and run the below command to install the MSOnline Powershell module if you have not already installed.
Install-
Module MSOnline
Run the below commands to list the available license SKUs.
Connect-MsolService Get-MsolAccountSku