Locating tenant that a subscription belongs to, from subscription id

Aaron 36 Reputation points

We're getting azure subscription payment overdue messages for a subscription that we can't find - is there any easy way to work out the tenant id/name from a given subscription id?

Azure Active Directory
Azure Active Directory
An Azure enterprise identity service that provides single sign-on and multi-factor authentication.
12,662 questions
No comments
{count} votes

Accepted answer
  1. Bas Pruijn 661 Reputation points

    Sure there is. Using this Powershell function you can find the tenantID of a subscriptionID:

    function get-tenantIdFromSubscriptionID($subId){
        $response = try {(Invoke-WebRequest -UseBasicParsing -Uri "https://management.azure.com/subscriptions/$($subId)?api-version=2015-01-01" -ErrorAction Stop).BaseResponse} catch { $_.Exception.Response } 
        $stringHeader = $response.Headers.ToString()

    Then you can go to https://portal.azure.com/*<tenantID*> to try to log into the specific tenant.

    To honor the source of this very helpful function: https://www.lieben.nu/liebensraum/2020/08/get-tenant-id-using-azure-subscription-id/

    No comments

1 additional answer

Sort by: Most helpful
  1. darsha-MSFT 11 Reputation points Microsoft Employee

    Hello @Aaron ,

    In order to check the subscription's tenant, you need to have RBAC access to the subscription.

    If you have access to the subscription then you can call this REST API and get the subscription's associated tenant ID https://learn.microsoft.com/en-us/rest/api/resources/subscriptions/get?tabs=HTTP.

    If you do not have access to the subscription and unsure under which tenant the subscription is residing, then I would suggest to open a Support ticket with Azure Subscription Management Team:


    Also, raising a support ticket to Azure Billing and Subscription management team is free of cost.

    I hope this helps.

    Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

    No comments