Skip to content

Latest commit

 

History

History
21 lines (14 loc) · 860 Bytes

list-service-principals-using-the-azure-cli.md

File metadata and controls

21 lines (14 loc) · 860 Bytes

List Service Principals Using The Azure CLI

To list service principals for a subscription, use the following command:

az ad sp list

List service principals for a subscription showing specific fields in JSON format:

az ad sp list --query "[].{accountEnabled:accountEnabled, appDisplayName:appDisplayName, appId:appId, id:id, createdDateTime:createdDateTime}"

List service principals for a subscription showing specific fields in tabular format:

az ad sp list --query "[].{accountEnabled:accountEnabled, appDisplayName:appDisplayName, appId:appId, id:id, createdDateTime:createdDateTime}" --output tsv

If you need to output to a file for further inspection, pipe to a tab separated file using > service-principal-search.tsv on Windows or | service-principal-search.tsv on macOS then import the file into Excel.