Friday, 12 July 2019

How to find your tenant name in Office 365

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:
https://graph.microsoft.com/v1.0/organization
#Select only verifiedDomains property
https://graph.microsoft.com/v1.0/organization?$select=verifiedDomains
List domains endpoint:
https://graph.microsoft.com/v1.0/domains
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.
{
 "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
How to find your tenant name from OneDrive URL


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
How to find my tenant name from SharePoint Site URL


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
How to find my tenant name using Powershell


Advertisements
Advertisements

No comments:

Post a Comment