In this article, let us see how to get the Tenant ID of our Office 365 Tenant.
Option 1 – Through the Screen
1. Get from the Azure Active Directory Properties.
2. Go to the Admin Portal and Click on the Azure Active directory – https://portal.office.com/adminportal/home#/homepage
3. On the Azure Active Directory page, the properties will be displayed as below. The Value on the Directory ID is the Tenant ID. Make a note of this and we can use wherever we want.
Option 2 – By PowerShell Script
#Install the Microsoft Online Module
Install-Module MSOnline
#Get the Credentials and connect with the Tenant
$UserCredential = Get-Credential
Connect-MsolService -Credential $UserCredential
#Get the Tenant ID
Get-MSOLCompanyInformation | select objectID
When we try to install the MSOnline module for the first time, it will prompt the below screen and give Yes in it.
Happy Coding,
Sathish Nadarajan.
Leave a comment