Skip to content

Latest commit

 

History

History
73 lines (66 loc) · 1.49 KB

azure_ad_cli.md

File metadata and controls

73 lines (66 loc) · 1.49 KB

Azure AD CLI Cheat Sheet

Useful commands, append | jq to view results in pretty colors.

Install Azure CLI

Install instructions for Debian/Ubuntu. Install Azure CLI with apt

Authentication

Login

Login to account.

az login --allow-no-subscriptions

Confirm successful login.

az account show

Logout

Log out of account.

az logout

Query Users, Groups, or Group Memberships

Query all users

az ad user list

Query user

az ad user show [email protected]

Query all groups

az ad group list

Query group

az ad group show --group "azure-objectid-identifiers-1a2b3c"

Query Usage

Using json example output for targed attributes.

az ad user show --upn-or-object-id [email protected] --query '{name:displayName, UPN:userPrincipalName}' -o json
{
  "UPN": "[email protected]",
  "name": "first last"
}

All user objects

az ad user list --query '[].{name:displayName, UPN:userPrincipalName}' -o json
{
  "UPN": "[email protected]",
  "name": "first last",
  "UPN": "[email protected]",
  "name": "first last", 
}

Install Azure DevOps

Add the azure-devops extension

az extension add --name azure-devops

Configure project

Configure and add project

az devops configure --defaults organization=https://dev.azure.com/contoso project=ContosoWebApp