> For the complete documentation index, see [llms.txt](https://cookiez.gitbook.io/red-team/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cookiez.gitbook.io/red-team/cloud/azure/discovery.md).

# Discovery

Even if we only know the domain name or email addresses of the target organization

* defcorphq

We can extract some interesting information:

– If the target organization uses Azure tenant&#x20;

– Tenant ID&#x20;

– Tenant name&#x20;

– Authentication type (Federation or not)&#x20;

– Domains&#x20;

– Azure Services used by the target organization&#x20;

– Guess email IDs

<table data-full-width="true"><thead><tr><th width="315">Context</th><th width="347">Command</th><th width="398">Example Output</th><th data-type="checkbox"></th></tr></thead><tbody><tr><td>Get if Azure tenant is in use, tenant name and Federation</td><td><a href="https://login.microsoftonline.com/getuserrealm.srf?login=%5bUSERNAME@DOMAIN%5d&#x26;xml=1">https://login.microsoftonline.com/getuserrealm.srf?login=%5bUSERNAME@DOMAIN%5d&#x26;xml=1</a></td><td></td><td>false</td></tr><tr><td>Get the Tenant ID</td><td>https://login.microsoftonline.com/[DOMAIN]/.well- known/openid-configuration</td><td></td><td>false</td></tr><tr><td>Validate Email ID by sending requests to</td><td><a href="https://login.microsoftonline.com/common/GetCredentialType">https://login.microsoftonline.com/common/GetCredentialType</a></td><td></td><td>false</td></tr></tbody></table>

## AADInternals

Use AADInternals tool from <https://github.com/Gerenios/AADInternals> for recon.

```powershell
Import-Module C:\AzAD\Tools\AADInternals\AADInternals.psd1 -Verbose
```

{% stepper %}
{% step %}
Get tenant name, authentication, brand name (usually same as directory name) and domain name. The username can be even a non-existent one in the defcorphq tenant.

```powershell
Get-AADIntLoginInformation -UserName root@defcorphq.onmicrosoft.com
```

{% endstep %}

{% step %}
Get tenant ID

```powershell
Get-AADIntTenantID -Domain defcorphq.onmicrosoft.com
```

{% endstep %}

{% step %}

### Get tenant domains

```powershell
Get-AADIntTenantDomains -Domain defcorphq.onmicrosoft.com
Get-AADIntTenantDomains -Domain deffin.onmicrosoft.com
Get-AADIntTenantDomains -Domain microsoft.com
```

{% endstep %}

{% step %}

### Get all information

```powershell
Invoke-AADIntReconAsOutsider -DomainName defcorphq.onmicrosoft.com
```

{% endstep %}
{% endstepper %}

## o365creeper

We can use o365creeper (<https://github.com/LMGsec/o365creeper>) to check if an email ID belongs to a tenant. It makes requests to the GetCredentialType API that we saw earlier.

```powershell
Examples:
o365creeper.py -e test@example.com
o365creeper.py -f emails.txt
o365creeper.py -f emails.txt -o validemails.txt
```

{% hint style="danger" %}
This tool is still using Python 2.7
{% endhint %}

## MicroBurst

Azure services are available at specific domains and subdomains. We can enumerate if the target organization is using any of the services by looking for such subdomains. The tool that we will use for this is MicroBurst (<https://github.com/NetSPI/MicroBurst>). Microburst is a useful tool for security assessment of Azure. It uses Az, AzureAD, AzurRM and MSOL tools and additional REST API calls!

```powershell
Import-Module C:\AzAD\Tools\MicroBurst\MicroBurst.psm1 -Verbose
```

{% stepper %}
{% step %}
Enumerate all subdomains for an organization specified using the '<mark style="color:orange;">-Base</mark>' parameter:

```powershell
Invoke-EnumerateAzureSubDomains -Base defcorphq -Verbose
```

{% endstep %}
{% endstepper %}
