+4 votes
2 views
in Azure by (1.4k points)

Can we get the Tenant ID of the azure active directory without using powershell command?

These two blogs helped me to solve my problem but is there any other way using which we can retrieve the ID

http://blogs.technet.com/b/heyscriptingguy/archive/2013/12/31/get-windows-azure-active-directory-tenant-id-in-windows-powershell.aspx

http://michaelcollier.wordpress.com/2013/10/28/windows-azure-ad-authentication-support-for-powershell/

2 Answers

+11 votes
by (10.6k points)

Follow the steps:

1.Login into the Azure portal

2. Go to active directory and select the directory of your requirement

3. Select the application and then configure it using configure option

4. Copy the information and paste it onto the Service Principal form on the ServiceNow instance

5. Collect Client ID and Tenant ID, now copy the Client ID into the text file

6. Collect the Tenant ID. It is in the form of a GUID.

https://docs.servicenow.com/bundle/istanbul-it-operations-management/page/product/azure-cloud-provisioning/task/t_CollectAzureClientTenantID.html

0 votes
by (39.2k points)

In the Azure CLI, you can use GNU/Linux):

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

This will ask you 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                   : [email protected]

data:    

info:    account show command OK

Are you interested in learning Azure from basics! Refer to this video on Azure provided by Intellipaat:

Or else, you can do this:

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

Or you can use the new az:

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

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

...