Get Azure And Office 365 Tenant ID With PowerShell

In this blog post, I will show you how to get your tenant ID for Azure and Office 365 using Microsoft PowerShell.

For this demonstration, I will use the Azure PowerShell command-line utility that runs on PowerShell 7.  The great advantage of using PowerShell 7 with Azure PowerShell is that it is a cross-platform utility which means that we can run it on Windows, Linux and macOS.

Let’s Start

To get started, make sure you install PowerShell 7 and install the Azure PowerShell modules by running the following cmdlet. To install PowerShell 7 on CentOS use this post for Windows use this.

install-module az

After installing PowerShell 7 and Azure PowerShell connect to the platform using the following cmdlet.


Get Tenant ID

To get your tenant ID run the following cmdlet.

get-aztenant | fl

The output will display the ID value and a few critical values that are related to your tenant.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.