How to Get the Tenant ID in SharePoint Online / Microsoft 365?
Requirement: Get Tenant ID from SharePoint Online / Microsoft 365.
What is my SharePoint Online Tenant ID?
When you subscribe to Office 365, You’ll be assigned a unique identifier as your Tenant ID. This Tenant ID is a GUID (globally unique identifier) that links all services in your Office 365 environment. Sometimes, you may need to know your Tenant ID, E.g., When deploying 3rd party applications, setting up a group policy for OneDrive for Business, Power BI Adoption Pack, etc. So, How do I retrieve my Tenant ID? In this article, we will discuss several ways to find the Tenant ID in Microsoft 365 SharePoint Online, including using the SharePoint Online Admin Center, SharePoint Online PowerShell module, Microsoft Graph API, and the Microsoft Azure Active Directory PowerShell module.
Here are some ways to find the Tenant ID in Microsoft 365 / SharePoint Online:
Table of contents
- What is my SharePoint Online Tenant ID?
- Option 1: Get Tenant ID from SharePoint Online Admin Center
- Option 2: PnP PowerShell to Find Get Tenant ID in SharePoint Online
- Option 3: Get Tenant ID from Microsoft Entra Admin Portal
- Option 4: Find the Tenant ID of any Microsoft 365 Domain from JSON
- Option 5: Find Tenant ID in Microsoft 365 using Graph API
- Summary
Option 1: Get Tenant ID from SharePoint Online Admin Center
To get the tenant ID from SharePoint Online, follow these steps:
- Login to your SharePoint Admin Center: https://tenant-admin.sharepoint.com
- From the SharePoint admin center, navigate to the App pages by Clicking on the “More features” link from left navigation >> Click on the “Open” button under “Apps”
- From the Apps page, click on the “More Features” >> “App Permissions” link. (URL shortcut: https://tenant-admin.sharepoint.com/_layouts/15/TA_AllAppPrincipals.aspx)
- The App Permissions Page lists all apps, display names, and app identifiers. In the “App Identifier” column, what we get after the @ symbol is our Office 365 Tenant ID. So, here, in my case, the Tenant ID is “fa3d1825-7b1c-42c6-bbce-cxah5a6dd192”
Similarly, you can navigate to any of your site collection app permissions page (https://tenant.sharepoint.com/_layouts/15/AppPrincipals.aspx) from site settings to get the tenant ID info (if there are apps registered, BTW!).
Option 2: PnP PowerShell to Find Get Tenant ID in SharePoint Online
Here is how to get tenant ID in SharePoint Online with PnP PowerShell:
#Parameters
$TenantSiteURL = "https://crescent-admin.sharepoint.com"
#Connect to the tenant admin
Connect-PnPOnline -Url $TenantSiteURL -Credentials (Get-Credential)
#Get the Tenant ID
Get-PnPTenantID
You can also get the tenant ID by,
#Set Config Parameter
$SiteURL = "https://crescent.sharepoint.com/"
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)
#Get Tenant ID
Get-PnPAuthenticationRealm
Option 3: Get Tenant ID from Microsoft Entra Admin Portal
We can retrieve the Tenant ID from the Azure AD with PowerShell, as:
#Get credentials
$Cred = Get-Credential
#Connect to Azure AD
Connect-AzureAD -Credential $Cred | Select TenantDomain, TenantId
Apart from Azure PowerShell, You can also get the tenant ID from the Azure portal. Just log in to the Microsoft Entra Admin Center (Azure portal) at https://portal.azure.com and open the Azure Active Directory module properties. You’ll find the Tenant Properties like Tenant Name, Tenant ID (Organization name, Directory ID) in the screenshot below:
Option 4: Find the Tenant ID of any Microsoft 365 Domain from JSON
You can also find the tenant ID of any domain, with the URL https://login.microsoftonline.com/<DOMAIN-NAME>/.well-known/openid-configuration. E.g., navigate to this URL in the browser https://login.microsoftonline.com/crescent.com/.well-known/openid-configuration, and then get the tenant ID:
Option 5: Find Tenant ID in Microsoft 365 using Graph API
Use the following PowerShell script to retrieve the Tenant ID using the Microsoft Graph API: Make sure the Microsoft Graph PowerShell module is installed before running this script.
#Connect to Microsoft Graph
Connect-MgGraph
#Get Tenant Properties
Get-MgOrganization | Select ID
Please ensure you have the necessary permissions and authentication set up to access this information through the Microsoft Graph API.
Summary
Knowing how to find your Microsoft 365 or SharePoint Online tenant ID can be helpful for various administration tasks and integrating with other applications. By following the simple steps outlined in this article, you can locate and copy the unique GUID for your organization’s SharePoint tenant. Whether you need the tenant ID for PowerShell scripts, configuring workflows, custom development, or managing tenant properties and policies, you now have the tools to access this key identifier quickly.