In many cases you need to know the tenant ID of your Azure AD tenant. It’s easy to obtain this information using PowerShell or the Azure Portal.
If you like easy then have a look at our tip at the end of this article!
Get Azure Tenant ID With PowerShell
To retrieve your tenant id using PowerShell you simply need to connect to your Azure AD using the Connect-AzureAD commandlet. This commandlet is part of the AzureAD module, so if you don’t have this module installed already, you need to grab it from the PowerShell Gallery:
- Install-Module AzureAD
When the module is installed you can run the Connect-AzureAD command, which will prompt you for your username, password and any multifactor authentication you have set up:
The tenant ID is readily available in the output from this command:
PS C:\> Connect-AzureAD Account Environment TenantId TenantDomain AccountType ------- ----------- -------- ------------ ----------- firstname.lastname@example.org AzureCloud c1493961-2ba6-41ae-b462-e3e7e4dae630 skrubbeltrang.onmicrosoft.com User
If you want to dive more into the tenant information, use the Get-AzureADTenantDetail commandlet:
This command returns a JSON document and the easiest way to handle this output is by inserting it into a variable.
An example of this is shown in the below output:
PS C:\> $tenant = Get-AzureADTenantDetail PS C:\> $tenant | ft DisplayName,CountryLetterCode,City,Postalcode,TelephoneNumber DisplayName CountryLetterCode City PostalCode TelephoneNumber ----------- ----------------- ---- ---------- --------------- skrubbeltrang & platz DK Middelfart 5500 12 345 678
Edit: As noted by Matthew Prentice, enterprise specialist with All Covered, to grab the tenant ID programmatically, use the objectId property of the output from the Get-AzureADTenantDetail command:
PS C:\> (Get-AzureADTenantDetail).objectId c1493961-2ba6-41ae-b462-e3e7e4dae630
Get Azure Tenant ID With Azure Portal
To retrieve the tenant ID from the Azure Portal start by logging in.
Then search for and open the Azure AD Service:
In the Azure AD the tenant ID is visible in the tenant information box:
As seen in the above steps it’s very easy to pick up the tenant ID of your Azure AD. This is a useful parameter when dealing with multiple tenants, doing cross-tenant mail migrations and other advanced tasks.
To easily manage Office 365 users, mailboxes and licenses have a look at our tool Easy365Manager. A growing number of admins in Oceania, Europe and United States are starting to work smarter with Easy365Manager. You should too!
Easy365Manager is available as a 30 day no limits free trial.
Easy365Manager integrates the administration of on-premises user accounts and Office 365 mailboxes and licenses thereby saving you tons of time.
With Easy365Manager you can finally remove your on-premises Exchange Server.