I am trying to create a simple PHP script that uses oAuth and I seem to require the Tenant ID of my SharePoint Online account. I'm sure this is something very straight forward, but I can't seem to locate it.
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.Sign up to join this community
I found this approach (blog.scoreman.net) easier:
Navigate to https://.sharepoint.com/_layouts/appprincipals.aspx. Identify the row with your registered application and look at the App Identifier column. The unique identifier after the @-sign in the App Identifier is the app realm. Copy the realm (not the whole App Identifier just the last part after the @-sign).
Tenant ID is nothing but SharePoint Online Site Realm.
You can get this by having a REST call to the site API.
Follow below steps:
Make a Get request
Check the below post for complete step to be followed:
You can get the the Tenant ID from the Azure Active Directory admin center. Navigate to https://aad.portal.azure.com/ and the select Azure Active Directory in the left navigation. The Overview page displays the Tenant ID.
easiest approach which does not require authentication is here.
for SharePoint Online and Office 365 Tenant id is the same as Azure directory id.
above URL will return JSON for open id connect. Extract guid from
token_endpoint property. extracted GUID is your Tenant Id(Tenant Id and directory id is same)