Update 2019-09-09: Add SharePoint REST API
What is a Tenant ID? When you subscribe to Microsoft 365, Microsoft provides you a full environment with several services (SharePoint, Teams, Azure Active Directory, etc.). In order to link all of these services between them and on your environment, they use a unique identifier which is your Tenant ID.
The Tenant ID is represented as GUID:
Generally, you do not need to know your Tenant ID but sometimes, essentially for the developers or when your company needs to deploy an app (ex: enable PowerBI Microsoft 365 Usage Analytics), you need to.
How to retrieve your Tenant ID? Here, some ways to find it!
Azure Active Directory
By default, all the users of your company have access to the Azure Portal.
Once you are connected to your https://portal.azure.com, clic on
Azure Active Directory, then
Properties and this is the Directory ID
Microsoft 365 Admin Center
For the users accounts with at least the Reports reader role
Once your are connected to your https://admin.microsoft.com, expand
Reports from the left navigation and clic on
Usage. At the bottom of the page, you should find the Microsoft 365 usage analytics with your Tenant ID.
SharePoint Admin Center (App permissions)
For SharePoint administrators only
Once you are connected to your SharePoint Admin Center (
https://yourdomain-admin.sharepoint.com), clic on
Classic features from the left navigation, then clic on
Open under Apps section and clic on
App Permissions (last link).
On this page, you will see some Apps with an unique identifier. Each identifier contains a claim with an ID followed by an at ("@") and your Tenant ID (ex: i:0i.t|ms.sp.ext|[email protected])
It is a little bit more complex to find the Tenant ID from a SharePoint site but you can do it too.
Open any modern SharePoint site (or classic) and open the Web Inspector / Web Developer Console
- On Windows, it is generally F12
- On MAC OS X, it is generally CMD + OPTION + i
Once opened, launch a search on "siteSubscriptionId"
- On Windows: CTRL + F
- On MAC OS X: CMD + F
Rest API URL
Firstly, open your favorite web browser and go to any SharePoint site collection then, edit the URL like this:
contosoby your own domain name.
the result will be a little bit huge... But perform a search on "SPS-DistinguishedName":
here an example of the value (the first
OU correspond to your Tenant ID):
CN=00000000-1111-2222-3333-444444444444,OU=[YOUR TENANT ID],OU=Tenants,OU=MSOnline,DC=SPODS0123456789,DC=msoprd,DC=msft,DC=net
All the users who have a Microsoft Teams licence, can reach their https://portal.office.com and clic on the Teams tile or access it directly from their Desktop application.
Once connected to the application (web or desktop), you can show your Tenant ID by sharing:
Clic on the ellipsis on the right of Team or Channel and clic on
Get a link ...; at the end of the URL, you will see your Tenant ID.
All the users who have a PowerApps licence, can reach their https://portal.office.com and clic on the PowerApps tile.
Once redirected to the PowerApps home page, the Tenant ID is visible from the URL.
All the users who have a Microsoft Flow licence, can reach their https://portal.office.com and clic on the Flow tile.
Once redirected to the Microsoft Flow home page, clic on
My Flows from the left navigation and the Tenant ID is visible from the URL.
For Stream administrators only
Once redirected to the Microsoft Stream home page, clic on Settings (gear) from Microsoft 365 top bar then, clic on
Admin settings link.
From the left navigation, expand
Manage Stream and clic on
logged to your environment, the following command will return your Tenant ID:
tenant id get --domainName mydomain.onmicrosoft.com
and the result is:
The only thing you have to do, is to connect into your environment with the following command:
once connected, the result is:
Azure Active Directory PowerShell
The only thing you have to do, is to connect into your environment with the following cmdlet:
$AzCreds = Get-Credential Connect-AzureAD -Credential $AzCreds
and the result is:
For the developers who need use the Tenant ID into their SharePoint Framework components, you will find it like that:
Hoping this post will help you 😉