1. First run the command below in powershell, substituting the subscription ID into the last line.
function Get-TenantIdFromSubId ($subId) {
$url = "https://management.azure.com/subscriptions/$($subId)?api-version=2015-01-01"
try {
Invoke-WebRequest -Uri $url -Method Get -ErrorAction Stop
} catch {
# Extract the Tenant ID from the WWW-Authenticate header in the 401 response
$authHeader = $_.Exception.Response.Headers["WWW-Authenticate"]
if ($authHeader -match "https://login.windows.net/([a-f0-9-]+)") {
return $matches[1]
}
}
return "Tenant not found or ID invalid."
}
# Usage:
Get-TenantIdFromSubId "your-subscription-id-here"
2. After you get your tenant ID, go to the page below to identify the tenant.
https://sub2tenant.com/
No comments:
Post a Comment