💡 Learn more : Azure portal documentation.
Your Office 365 tenant ID is a globally unique identifier (GUID) that is different than your tenant name or domain. On rare occasion, you might need this identifier, such as when configuring Windows group policy for OneDrive for Business.
Knowing this, you'll find that there are times when you will want to grab the Tenant Id and while you can do this through PowerShell, sometimes it is just as easy to grab this through the Azure Portal.
The DirectoryId and TenantId both equate to the GUID representing the ActiveDirectory Tenant. Depending on context, either term may be used by Microsoft documentation and products, which can be confusing.
Open the Azure Portal and navigate to Azure Active Directory, then Properties and copy the Directory ID
In other words, the "Tenant ID" IS the "Directory ID".
You can also do this via Azure CLI or Azure Powershell:
az account show --subscription "MySubscriptionName" --query tenantId --output tsv az account list --query .tenantId --output tsv
Get-AzTenant | Select-Object -ExpandProperty Id
I hope it helps!