How to get the ID of the owner of the azure account?

My question is: is it possible to get the Azure Active Directory client ID without using the powershell command?

I found these two blogs and with this help I was able to get the tenant ID and subscription ID from powershell. Is this the only way to return the tenant?

Get the Windows Azure Active Directory Client ID in Windows PowerShell

Windows Azure AD Authentication Support for PowerShell

thank

+174
azure azure-active-directory
Oct 15 '14 at 13:37
source share
20 answers

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

The note

added 12/18/2017

As indicated by shadowbq, DirectoryId and TenantId are equal to the GUID representing Tenant's ActiveDirectory. Depending on the context, Microsoft documentation and products may use any of these terms, which may be confusing.

Assumptions

  • You have access to the Azure portal

Decision

Client ID bound to Activedirectory in Azure

  • Go to toolbar
  • Go to ActiveDirectory
  • Go to Management / Properties
  • Copy Directory ID
  • profit

Azure ActiveDirectory Tenant ID

Yes, I used paint, do not judge me.

+241
Dec 07 '16 at 22:12
source share

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

+101
Oct. 15 '14 at 15:27
source share

My team is very tired of trying to find a tenant ID for our O365 and Azure projects. The developers, the support team, the sales team, all need this at some point and never remember how to do it.

So, we created this small site in the same spirit as whatismyip.com. Hope you find it useful!

https://www.whatismytenantid.com

+48
Feb 09 '18 at 16:33
source share

The tenant ID is also present in the URL of the management console when navigating to the specified Active Directory instance, for example,

https://manage.windowsazure.com/<morestuffhere>/ActiveDirectoryExtension/Directory/BD848865-BE84-4134-91C6-B415927B3AB1 

Azure Mgmt Console Active Directory

+39
Apr 14 '15 at 19:14
source share

In Azure CLI (I use GNU / Linux):

 $ azure login # add "-e AzureChinaCloud" if you're using Azure China 

You will be prompted to log in via https://aka.ms/devicelogin or https://aka.ms/deviceloginchina.

 $ azure account show info: Executing command account show data: Name : BizSpark Plus data: ID : aZZZZZZZ-YYYY-HHHH-GGGG-abcdef569123 data: State : Enabled data: Tenant ID : 0XXXXXXX-YYYY-HHHH-GGGG-123456789123 data: Is Default : true data: Environment : AzureCloud data: Has Certificate : No data: Has Access Token : Yes data: User name : nico@XXXXXXX.onmicrosoft.com data: info: account show command OK 

or simply:

 azure account show --json | jq -r '.[0].tenantId' 

or new az:

 az account show --subscription a... | jq -r '.tenantId' az account list | jq -r '.[].tenantId' 

I hope this helps

+37
Apr 6 '16 at 15:38
source share

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

enter image description here

+32
Jun 24 '17 at 6:22
source share

This answer was provided on the Microsoft website and was updated on March 21, 2008:

https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-create-service-principal-portal

In short, here are the screenshots from the walkthrough:

  1. Select Azure Active Directory.

Azure Active Directory

  1. To get the client ID, select Properties for your Azure AD client.

Select properties

  1. Copy the directory identifier. This value is your tenant ID.

Copy the Directory ID, this is the tenant ID.

Hope this helps.

+18
Apr 21 '18 at 19:38
source share

Via PowerShell anonymously:

 PS C:\> (Invoke-WebRequest https://login.windows.net/YOURDIRECTORYNAME.onmicrosoft.com/.well-known/openid-configuration|ConvertFrom-Json).token_endpoint.Split('/')[3] 
+9
Sep 17 '15 at 17:57
source share

Another way to get it from application registration

Azure Active Directory App registrations click on the application and it will show tenant ID client tenant ID

enter image description here

+8
Oct 30 '18 at 17:08
source share

For now (07/06/2018), a simple approach would be to start showing your Az account in the Azure cloud shell (storage account required) in the Azure portal .

--- Team ---

 az account show 

--- Command output ---

 { "environmentName": "AzureCloud", "id": "{Subscription Id (GUID)}", "isDefault": true, "name": "{Subscription Name}", "state": "Enabled", "tenantId": "{Tenant Id (GUID)}", "user": { "cloudShellID": true, "name": "{User email}", "type": "user" } } 

For more information about the Azure cloud shell, see https://docs.microsoft.com/en-us/azure/cloud-shell/overview .

+5
Jun 07 '18 at 23:18
source share

You can run a simple curl call to get the azure subscription tenant ID without any authentication.

make a curl call to:

https://management.azure.com/subscriptions/{subscription-id}?api-version=2015-01-01

The request will fail, but you can get the tenant ID from the response header. The tenant ID is present on the line, and then "WWW-Authenticate: Bearer authorization_uri =" https://login.windows.net/ "

you can use curl -v to display the response header.

+4
Mar 16 '17 at 0:10
source share

In PowerShell:

 Add-AzureRmAccount #if not already logged in Get-AzureRmSubscription -SubscriptionName <SubscriptionName> | Select-Object -Property TenantId 
+3
Mar 31 '17 at 15:18
source share

If you have an Azure CLI installation, you can run the command below,

 az account list 

or find it in ~/.azure/credentials

+2
May 7 '18 at 20:39
source share

Use the Azure CLI

 az account get-access-token --query tenant --output tsv 
+2
Apr 6 '19 at 20:07 on
source share

From Java:

 public static String GetSubscriptionTenantId (String subscriptionId) throws ClientProtocolException, IOException { String tenantId = null; String url = "https://management.azure.com/subscriptions/" + subscriptionId + "?api-version=2016-01-01"; HttpClient client = HttpClientBuilder.create().build(); HttpGet request = new HttpGet(url); HttpResponse response = client.execute(request); Header[] headers = response.getAllHeaders(); for (Header header : headers) { if (header.getName().equals("WWW-Authenticate")) { // split by '"' to get the URL, split the URL by '/' to get the ID tenantId = header.getValue().split("\"")[1].split("/")[3]; } } return tenantId; } 
+1
May 08 '16 at 16:15
source share

According to Microsoft:

Find your tenantID: Your tenantId can be opened by opening the following metadata.xml document: https://login.microsoft.com/GraphDir1.onmicrosoft.com/FederationMetadata/2007-06/FederationMetadata.xml - replace "graphDir1.onMicrosoft.com ", with your tenant’s domain value (any domain owned by the tenant will work). TenantId is a landmark that is part of the sts url returned in the first xml node sts url ("EntityDescriptor"): for example. " https://sts.windows.net/ ".

Link:

https://azure.microsoft.com/en-us/resources/samples/active-directory-dotnet-graphapi-web/

+1
Jun 06 '17 at 19:06
source share

You can also get the tenant ID, virtually all of the subscription data, by going to resources.azure.com url

0
Dec 11 '17 at 18:58
source share

An easy way to get tenantID is

Connect-MsolService -cred $ LiveCred # log in to the tenant

(Get-MSOLCompanyInformation) .objectid.guid #get tenantID

0
Jan 25 '19 at 20:09
source share

For AAD-B2C, it's pretty simple. On the Azure portal that the B2C directory is associated with, go to the B2C directory (I added "Azure AD B2C" to the portal’s left menu). In the B2C directory, click the "User Streams (Policies)" menu item. In the policies pane, click one of the previously added policies to select it. She should open the panel for the policy. Click "Properties." In the next Panel, this is the section “Token Compatibility Settings” with the “Issuer” property. Your AAD-B2C client GUID is contained in the URL.

0
Jun 25 '19 at 9:53 on
source share
 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" } 
-2
Jul 10 '18 at 20:34
source share



All Articles