How to get the azure account tenant Id?

后端 未结 21 1301
故里飘歌
故里飘歌 2020-11-30 17:47

My question is: Is it possible to get the azure active directory tenant id without using powershell command?

I found this two blogs and with this help, I\'m already

相关标签:
21条回答
  • 2020-11-30 18:37

    Go to https://login.windows.net/YOURDIRECTORYNAME.onmicrosoft.com/.well-known/openid-configuration and you'll see a bunch of URLs containing your tenant ID.

    0 讨论(0)
  • 2020-11-30 18:38

    Use the Azure CLI

    az account get-access-token --query tenant --output tsv
    
    0 讨论(0)
  • 2020-11-30 18:39

    If you have installed Azure CLI 2.0 in your machine, you should be able to get the list of subscription that you belong to with the following command,

    az login
    

    if you want to see as a table output you could just use

    az account get-access-token --query tenant --output tsv
    

    or you could use the Rest API

    https://docs.microsoft.com/en-us/rest/api/resources/tenants/list

    0 讨论(0)
  • 2020-11-30 18:40

    Just to add a new method to an old (but still relevant question). In the new portal, clicking the help icon from any screen and selecting 'Show Diagnostics' will show you a JSON document containing all your tenant information including TenantId, Tenant Name, and much, much more useful information

    0 讨论(0)
  • 2020-11-30 18:40
    xxx@Azure:~$ az ad sp create-for-rbac
    Retrying role assignment creation: 1/36
    {
      "appId": "401143c2-95ef-4792-9900-23e07f7801e7",
      "displayName": "azure-cli-2018-07-10-20-31-57",
      "name": "http://azure-cli-2018-07-10-20-31-57",
      "password": "a0471d14-9300-4177-ab08-5c45adb3476b",
      "tenant": "e569f29e-b008-4cea-b6f0-48fa8532d64a"
    }
    
    0 讨论(0)
  • 2020-11-30 18:41

    Time changes everything. I was looking to do the same recently and came up with this:

    Note

    added 12/18/2017

    As indicated by shadowbq, 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.

    Assumptions

    • You have access to the Azure Portal

    Solution

    The tenant ID is tied to ActiveDirectoy in Azure

    • Navigate to Dashboard
    • Navigate to ActiveDirectory
    • Navigate to Manage / Properties
    • Copy the "Directory ID"

    Yes I used paint, don't judge me.

    0 讨论(0)
提交回复
热议问题