How to Get the Tenant ID in SharePoint Online?
Requirement: Get Tenant ID from SharePoint Online.
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 that links all services in your Office 365 environment. At times, you may need to know your Tenant ID, E.g., When deploying 3rd party applications, setting up a group policy for OneDrive for Business, PowerBI Adoption Pack, etc. So, How do I retrieve my Tenant ID? Here are some ways to find it!
How to Find the SharePoint Online Tenant ID?
To get tenant id from SharePoint Online, follow these steps:
- Login to your SharePoint Admin Center: https://tenant-admin.sharepoint.com
- From the SharePoint admin center, navigating to the App pages by Click on the “More features” link from left navigation >> Click on the “Open” button under “Apps”
- From the Apps page, click on the “App Permissions” link. (URL shortcut: https://tenant-admin.sharepoint.com/_layouts/15/TA_AllAppPrincipals.aspx)
- The App Permissions Page lists all apps, display name 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’s “App Permissions” page (https://tenant.sharepoint.com/_layouts/15/AppPrincipals.aspx) from site settings to get tenant ID (if there are apps registered, BTW!).
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
Get Tenant ID from Azure AD
We can retrieve the Tenant Id from Azure AD web interface: https://docs.microsoft.com/en-us/onedrive/find-your-office-365-tenant-id. With PowerShell, we can retrieve it, as:
#Get credentials
$Cred = Get-Credential
#Connect to Azure AD
Connect-AzureAD -Credential $Cred | Select TenantDomain, TenantId
You can also get the tenant ID from the Azure portal as well. Just login to the Azure portal at https://portal.azure.com and open the Azure Active Directory module properties. You’ll find the Tenant ID as in the below screenshot: