How To Get Azure Tenant ID

Tenant ID

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-MgGraph commandlet. This commandlet is part of the Microsoft Graph module, so if you don’t have this module installed already, you need to grab it from the PowerShell Gallery:

Install-Module Microsoft.Graph

Warning! The Microsoft Graph module is close to 1 GB!

When the module is installed, you can run the Connect-MgGraph command, which will prompt you for your username, password, and any multifactor authentication you have set up:

Connect-MgGraph -Scopes "Domain.Read.All"

Then use the following command to grab the Azure Tenant ID:

(Get-MgDomain | Where-Object {$_.isDefault}).Id

If you want to dive more into the tenant information, use the Get-MgOrganization commandlet:

Get-MgOrganization | fl

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:\> Get-MgOrganization | fl DisplayName,CountryLetterCode,CreatedDateTime,OnPremisesSyncEnabled,OnPremisesLastSyncDateTime,AssignedPlans

DisplayName                : Skrubbeltrang & Platz ApS
CountryLetterCode          : DK
CreatedDateTime            : 9/29/2022 2:11:44 PM
OnPremisesSyncEnabled      : True
OnPremisesLastSyncDateTime : 4/13/2023 11:23:43 AM
AssignedPlans              : {882e1d05-acd1-4ccb-8708-6ee03664b117, eec0eb4f-6444...}

Edit: As noted by Matthew Prentice, enterprise specialist with All Covered, to grab the tenant ID programmatically, use the Id property of the output from the Get-MgOrganization command:

PS C:\> (Get-MgOrganization).Id

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:

Get Tenant ID

In the Azure AD the tenant ID is visible in the tenant information box:

Get Tenant ID

How to Simplify Hybrid Office 365 Management

Unfortunately, the standard tools from Microsoft make it very complex to manage hybrid Office 365.

Daily operations involve multiple tools and scripting, e.g.:

  • AD Users & Computers to manage on-premises identities.
  • On-premises Exchange to manage on-premises email configuration.
  • Exchange Online Admin Center to manage Office 365 mailboxes.
  • Microsoft Admin Center to manage Office 365 users, licenses, and shared mailbox sent-to-items configuration.
  • Azure Portal to view and manage detailed Office 365 user properties.
  • Exchange Online PowerShell to configure calendar permissions, auto-reply scheduling, and Outlook auto-mapping.
  • Azure AD Connect PowerShell to trigger AD to Office 365 synchronizations.

This is very confusing, requires a lot of training of first-line supporters, and often results in senior-level admins getting involved in what should be day-to-day user support.

Additionally, you carry the cost and risk of running Exchange on-premises.

You can make all of these problems go away in two minutes.

With Easy365Manager, all daily management can be done directly from AD Users & Computers.

Easy365Manager adds two new tabs to user properties, giving you complete control of all standard  Office 365 mailbox settings, licenses, email addresses, etc.

You no longer need to log in to multiple consoles, and you don’t need to worry about attribute authority. Instead, all configurations take place in one well-known console.

Since AD Users & Computers has been around for more than two decades, any first-line supporter knows this and will master the new features with basically zero training.

With Easy365Manager, hybrid Office 365 becomes easy. Even when dealing with calendar permissions, which otherwise can only be managed via complex PowerShell scripting:

And it gets even better:

Easy365Manager is available as a 30-day trial which you can install and configure in less than two minutes.

Easy365Manager is a simple extension to the AD Users & Computers tool, and it introduces no changes to your schema or infrastructure.

Easy365Manager installs to any system running AD Users & Computers – even Windows 10.

Easy365Manager has no custom security layer, works with your Azure AD Connect, and runs parallel with (or without) your on-premises Exchange Server.

The (easy) changes you make using Easy365Manager result in the same configuration as when using the standard tools from Microsoft.

If you don’t have time to test Easy365Manager this week, ask yourself: Do you have time not to…?