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 with a unique identifier as your Tenant ID.  This Tenant ID is a GUID that links all of the 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, 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 "More features" link from left navigation >> Click on "Open" button under "Apps"
  • From the Apps page, click on "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"
    find sharepoint online tenant id
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 also we can retrieve it, as:
#Get credentials
$Cred = Get-Credential

#Connect to Azure AD
Connect-AzureAD -Credential $Cred | Select TenantDomain, TenantId

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.