How to get Tenant ID using the SharePoint Online App Principal Page

How to get Tenant ID using the SharePoint Online App Principal Page?

No comments

 5,994 total views,  7 views today

Pass record Id to Visualforce page ...
Pass record Id to Visualforce page in Salesforce Lightning Record Page

In this “How to get Tenant ID” article, we will learn how we can get a Tenant ID using the SharePoint Online App Principal (“appprincipals.aspx” ) page. Using the client ID and Client secret we can generate the Tenant ID from the postman tool – but that process is complicated, in this article In 4 steps access SharePoint online data using the postman tool has explained how we can generate Tenant ID using the postman tool.

Another easier way, we have explained how we can quickly get the Tenant ID from the Azure Portal and Azure PowerShell.

In this article, we will learn quicker than the previous two approaches, how we can get the Tenant ID from SharePoint Online page itself step by step, in order to configure the App Only Authentication, we must follow the below two steps:

Step 1: Register your app on the SharePoint site

Go to this page:

 "https://<YourSharePointCollectionURL>/_layouts/15/appregnew.aspx"

Example:

 "https://globalsharepoint2020.sharepoint.com/sites/CustomSearchRND/_layouts/15/appregnew.aspx"

Client ID and Client Secret from SharePoint Online App Registration Page

Click on the create button and Note down the above information:

The app identifier has been successfully created.
Client Id: c9a55e05-7b67-4873-97f3-1ce135121c35
Client Secret: 8T2E0dlaOZ4UuRH9bzKEvl8rB9YMQR7SmIIZhUAXDg0=
Title: Test App Registration
App Domain: localhost
Redirect URI: https://localhost

Step 2:  Grant permission to your app – How to get Tenant ID

Go to this page:

"https://<YourSharePointCollectionURL>/_layouts/15/appinv.aspx"

Example:

"https://globalsharepoint2020.sharepoint.com/sites/CustomSearchRND/_layouts/15/appinv.aspx"

Permission Request XML for SharePoint Online App

Permission Request XML for SharePoint Online AppEnter the Client ID noted from the previous step and click on the “Lookup” button.

Then, inside the permission request XML box enter the below XML:

<AppPermissionRequests AllowAppOnlyPolicy="true">
<AppPermissionRequest Scope="http://sharepoint/content/sitecollection/web" Right="FullControl" />
</AppPermissionRequests>

Then, click on the create button.

On the next, page we will get the below confirmation message:

Do you trust SharePoint App Registration
Do you trust SharePoint App Registration?

Click on the Trust

Do you trust Test App Registration?

Let it have full control of this site.

Let it share its permissions with other users.

Let it access basic information about the users of this site.

Step 3: Get Tenant ID from SharePoint Online App Permissions Page (appprincipals.aspx)

Go to the page link :

 "https://<YourSharePointCollectionURL>/_layouts/15/appprincipals.aspx"

Example:

 "https://globalsharepoint2020.sharepoint.com/sites/CustomSearchRND/_layouts/15/appprincipals.aspx"
Get Tenant ID from SharePoint Online App Permissions Page
Get Tenant ID from SharePoint Online App Permissions Page

Here we can see the two pieces of information:

  • App Display Name
  • App Identifier

In-App, in the Identifier section, after the @ symbol, whatever we can see is, the Tenant ID, and before the @ symbol, is the client id.

Note:

  • Generally, to get the Tenant ID, we use the above two steps 1 & 2 and pass the client id and client secret in the postman tool as a parameter (it has a certain process which is quite complicated).

Summary: How to get tenant id

Thus, in this article, we have learned, how we can get a Tenant ID by using the SharePoint Online App Principals page (appprincipals.aspx).

See Also: How to get tenant id

You may also read the below two articles, to get the Tenant ID using the postman tool, Azure Portal and Azure PowerShell:

Buy the premium version of SharePoint Online & Office 365 administration eBook from here:

About Post Author

Do you have a better solution or question on this topic? Please leave a comment