On this page
First Token Tutorial
Your First Token - Complete Tutorial
This tutorial walks you through the complete process from setting up an app registration in Azure to generating your first token.
Prerequisites
- Azure subscription with access to create app registrations
- Entra Token CLI installed (Installation Guide)
- Basic understanding of Azure and authentication concepts
Step 1: Create an App Registration
1.1 Navigate to Azure Portal
- Go to Azure Portal
- Navigate to Azure Active Directory (or Microsoft Entra ID)
- Select App registrations from the left menu
- Click New registration
1.2 Register Your Application
Fill in the registration form:
- Name:
entratool-demo(or your preferred name) - Supported account types:
- Select “Accounts in this organizational directory only” for single tenant
- Or choose multi-tenant if needed
- Redirect URI: Leave blank for now (we’ll add later if needed)
Click Register
1.3 Note Your IDs
After registration, save these values:
- Application (client) ID: Found on the Overview page
- Directory (tenant) ID: Also on the Overview page
Step 2: Create a Client Secret
2.1 Generate Secret
- In your app registration, go to Certificates & secrets
- Click New client secret
- Add a description:
entratool-demo-secret - Choose expiration:
- 6 months for testing
- 24 months for longer-term use
- Click Add
2.2 Copy the Secret
⚠️ Important: Copy the secret Value immediately - it won’t be shown again!
Step 3: Configure API Permissions
3.1 Add Permissions
- Go to API permissions in your app registration
- Click Add a permission
- Select Microsoft Graph
- Choose Application permissions (for service-to-service)
- Search for and add these permissions:
User.Read.All(to read user information)- Or any other permissions your application needs
3.2 Grant Admin Consent
- Click Grant admin consent for [Your Organization]
- Confirm by clicking Yes
💡 Note: Admin consent is required for application permissions
Step 4: Create Your Profile
Now that your Azure app is configured, create a profile in entratool:
| |
Enter the following when prompted:
Profile name: demo-profile
Tenant ID: YOUR-TENANT-ID
Client ID: YOUR-CLIENT-ID
Scopes (comma-separated): https://graph.microsoft.com/.default
Authentication method: ClientSecret
Client secret: YOUR-CLIENT-SECRET
Set default OAuth2 flow? n
Configure custom redirect URI? nSuccess! Your profile is created and the secret is securely stored.
Step 5: Generate Your First Token
| |
You should see output like:
✓ Token retrieved successfully
Expires: 2025-12-26 15:30:00 UTC (59 minutes)
Scopes: https://graph.microsoft.com/.default
Token Type: Bearer
Token copied to clipboard!Step 6: Verify Your Token
6.1 Inspect the Token
| |
This shows the decoded JWT claims, including:
- aud: Audience (should be
https://graph.microsoft.com) - iss: Issuer (your Azure tenant)
- app_displayname: Your app name
- roles: Assigned application permissions
- exp: Expiration timestamp
6.2 Use the Token
Test your token with Microsoft Graph:
| |
You should receive a JSON response with user data!
Troubleshooting
“Invalid client secret”
- Verify you copied the secret value (not the secret ID)
- Check if the secret has expired
- Regenerate the secret if needed
“Insufficient privileges”
- Ensure you granted admin consent for the permissions
- Verify the permissions are Application permissions, not Delegated permissions
- Wait a few minutes for changes to propagate
“Token request failed”
- Double-check tenant ID and client ID
- Ensure network connectivity to Azure
- Check if your Azure subscription is active
What’s Next?
Explore different flows:
- Authorization Code Flow - For user authentication
- Device Code Flow - For limited-input devices
- Interactive Browser - For desktop applications
Learn about features:
- Scope Management - Using tokens for different APIs
- Certificate Authentication - Using certificates instead of secrets
- Profile Management - Managing multiple profiles
Try recipes:
- Calling Microsoft Graph - Common Graph API scenarios
- Custom APIs - Access your own APIs
- CI/CD Integration - Use in automated pipelines