az account get-access-token --resource https://management.azure.com --tenant $TENANT_ID
az account get-access-token --resource https://graph.azure.com --tenant $TENANT_ID
Get-AzAccessToken -ResourceUrl "https://management.azure.com" -TenantId $TENANT_ID
Get-AzAccessToken -ResourceUrl "https://graph.azure.com" -TenantId $TENANT_ID
Combining these obtained tokens allow us to run AzureHound correctly.
# List everything
./azurehound -j $ACCESS_TOKEN list -t $TENANT_ID -o output.json
# Use scoped token to enumerate EntraID
./azurehound -j $ACCESS_TOKEN list az-ad -t $TENANT_ID -o output.json
# Use scoped token to enumerate AzureRM Resources
./azurehound -j $ACCESS_TOKEN list az-rm -t $TENANT_ID -o output.json
Generating ARM tokens from a cloud shell causes issues, since the tenant cannot be specified and the audience of the token is overwritten. Generate the token from a regular az-cli session instead to force the audience of the token to be set correctily.