Extract Azure Tenant Name from ID with MS Graph

Mission Objective
Secure tenant name from an ID during sign-in analysis. Neutralize inefficient methods. Deploy Microsoft Graph for rapid execution.
Gear Check
- Enterprise App: Equip CrossTenantInformation.ReadBasic.All permission.
No App: Connect to Graph with global admin access. Your call.
The Play
Built a PowerShell function—GetTenantName. Deploy it to your profile for instant recall:
function GetTenantName {
param (
[string]$TenantId
)
# Connect to Graph prior—standard protocol
$url = "https://graph.microsoft.com/v1.0/tenantRelationships/microsoft.graph.findTenantInformationByTenantId(tenantId='$TenantId')"
$data = Invoke-MgGraphRequest -Uri $url
$intel = [pscustomobject]@{
Id = $data.tenantId
Name = $data.displayName
Domain = $data.defaultDomainName
}
Write-Host "ID: $($intel.Id)" -ForegroundColor Cyan
Write-Host "Name: $($intel.Name)" -ForegroundColor Cyan
Write-Host "Domain: $($intel.Domain)" -ForegroundColor Cyan
# Disconnect for a clean exit
Disconnect-MgGraph -ErrorAction SilentlyContinue
}
Execution
Link up with Graph, then hit:
GetTenantName -TenantId "your-tenant-id-here"
Output: ID, name, domain. Cyan for visibility. No clutter.
Mission Value
Azure AD ops, sign-in diagnostics—this cuts response time. Graph delivers intel straight from the source. No detours, no delays.
Field Notes
Got a tighter approach? Report in. Mainframe’s always optimizing.





