Client Secret Creation
Client Secret Creation
Instead of manually creating secrets in the Azure Portal and copying them, you can now create client secrets directly from Entra Auth Cli. The secret is automatically saved to your profile.
Quick Reference
| Feature | Details |
|---|---|
| Available in | config create, config edit, discover |
| Secret naming | EAC-EXP-DD-MMM-YY (expiry date) |
| Expiry period | 180 days from creation |
| Required permission | Application.ReadWrite.All |
Overview
When configuring a profile with client secret authentication, you’re presented with two options:
Client secret:
> Create new
Enter existing
Create new automates the process of:
- Authenticating to Microsoft Graph API
- Creating a new secret in the app registration
- Naming the secret with the expiry date
- Displaying the secret value (one-time view)
- Saving the secret to your profile
📸 Screenshot placeholder: secret-create-options.png
Description: Terminal showing the “Create new” and “Enter existing” selection prompt
Creating a New Secret
Step 1: Select “Create new”
When prompted for a client secret, choose “Create new”:
Client secret:
> Create new
Enter existing
Step 2: Authenticate
If not already authenticated, a browser window opens:
Creating a new secret requires signing in with an account that has
Application.ReadWrite.All or Application.ReadWrite.OwnedBy permission.
Opening browser for authentication...
Sign in with an account that has permission to modify the app registration.
📸 Screenshot placeholder: secret-auth-browser.png
Description: Browser authentication prompt for Microsoft Graph permissions
Step 3: Secret Created
The secret is created and displayed:
┌──────────────────────────────────────────────────────────────────┐
│ ⚠ Secret Value (copy now - shown only once!) │
├──────────────────────────────────────────────────────────────────┤
│ abc123...your-secret-value-here...xyz789 │
└──────────────────────────────────────────────────────────────────┘
┌─────────────────┬────────────────────────────────────────────────┐
│ Property │ Value │
├─────────────────┼────────────────────────────────────────────────┤
│ Application │ My Application Name │
│ Secret Name │ EAC-EXP-30-JUL-26 │
│ Expires │ 30 Jul 2026 (180 days) │
└─────────────────┴────────────────────────────────────────────────┘
✓ Secret created and saved to profile
📸 Screenshot placeholder: secret-created-display.png
Description: Terminal showing the created secret value in a highlighted panel with warning, plus details table
Secret Naming Convention
Secrets are named with a predictable format for easy management:
EAC-EXP-DD-MMM-YY
| Part | Meaning | Example |
|---|---|---|
EAC | Entra Auth Cli prefix | EAC |
EXP | Expiry indicator | EXP |
DD | Day of expiry | 30 |
MMM | Month (uppercase) | JUL |
YY | Year (2-digit) | 26 |
Full example: EAC-EXP-30-JUL-26
This naming makes it easy to:
- Identify secrets created by the CLI
- See when secrets expire at a glance
- Manage rotation schedules
📸 Screenshot placeholder: azure-portal-secrets.png
Description: Azure Portal showing Certificates & secrets page with EAC-named secrets visible
Required Permissions
Microsoft Graph Permissions
| Permission | Type | Purpose |
|---|---|---|
Application.ReadWrite.All | Delegated | Create secrets in any app |
Application.ReadWrite.OwnedBy | Delegated | Create secrets in apps you own |
Azure AD Roles
Your account also needs one of these roles:
- Application Administrator - Full app management
- Cloud Application Administrator - App management without directory access
- Owner - Owner of the specific app registration
Authentication Flow
The CLI uses interactive browser authentication with Microsoft Graph PowerShell’s public client ID. This ensures:
- Proper consent flow
- User context for permissions
- No need to configure additional apps
Error Handling
Insufficient Permissions
If you don’t have permission to create secrets:
⚠ Insufficient permissions to create client secret.
Required permission: Application.ReadWrite.All or Application.ReadWrite.OwnedBy
Would you like to enter an existing secret instead? (y/n): y
Enter client secret: ****
📸 Screenshot placeholder: secret-permission-error.png
Description: Terminal showing permission error with fallback option to enter existing secret
Application Not Found
Application with client ID '12345678-...' not found.
Would you like to enter an existing secret instead? (y/n):
Causes:
- App was deleted
- Client ID is incorrect
- You don’t have read access to the app
Network Errors
If the Graph API call fails:
Error creating client secret: Network error occurred
Would you like to enter an existing secret instead? (y/n):
Where Secret Creation is Available
config create
When creating a new profile:
entra-auth-cli config create
# ... profile name, tenant, client ID prompts ...
Authentication method:
> ClientSecret
Client secret:
> Create new
Enter existing
config edit
When editing an existing profile:
entra-auth-cli config edit -p my-profile
# Choose to change authentication method or update secret
Update client secret? (y/n): y
Client secret:
> Create new
Enter existing
discover
When creating a profile from app discovery:
entra-auth-cli discover -s "MyApp*"
# Select app, name profile, select scope...
Authentication method:
> ClientSecret
Client secret:
> Create new
Enter existing
Best Practices
✅ Copy the Secret Immediately
The secret value is only shown once. While it’s automatically saved to your profile, you may want to:
- Copy it for backup
- Store it in a password manager
- Document it securely
✅ Track Expiry Dates
With the EAC-EXP-DD-MMM-YY naming:
- Set calendar reminders 2 weeks before expiry
- Plan rotation before secrets expire
- Monitor secrets in Azure Portal
✅ Use for Development
Secret creation is ideal for:
- Development environments
- Testing and debugging
- Personal/team apps you own
⚠️ Production Considerations
For production environments, consider:
- Using certificates instead of secrets
- Managing secrets through Azure Key Vault
- Implementing automated rotation
- Following your organization’s security policies
❌ Avoid
- Creating secrets for apps you don’t manage
- Sharing the displayed secret value insecurely
- Ignoring expiry dates
Rotating Secrets
Create New, Keep Old Active
Edit your profile:
entra-auth-cli config edit -p my-profileChoose to update the secret
Select “Create new” - this creates a new secret, doesn’t delete the old one
Test the new secret works:
entra-auth-cli get-token -p my-profileDelete the old secret from Azure Portal
Why Keep Both Temporarily
- Zero-downtime rotation
- Rollback capability if issues arise
- Time for dependent systems to update
Security Considerations
Secret Visibility
The secret is displayed in your terminal:
- Clear terminal history after viewing
- Don’t share screenshots of the output
- Be aware of screen recording/sharing
Audit Trail
Secret creation is logged in Azure AD:
- Who created the secret
- When it was created
- Which application
Least Privilege
Request only the permissions you need:
Application.ReadWrite.OwnedByfor apps you own- Avoid
Application.ReadWrite.Allif not needed
Comparison: Create vs Enter Existing
| Aspect | Create New | Enter Existing |
|---|---|---|
| Convenience | High - one command | Lower - portal + CLI |
| Permissions needed | Application.ReadWrite.All | None (just the secret value) |
| Secret naming | Automatic (EAC-EXP-...) | Manual (you choose in portal) |
| Expiry period | Fixed (180 days) | Configurable in portal |
| Audit | Logged as your account | Logged as whoever created it |
| Best for | Dev, test, personal apps | Production, shared apps |
Troubleshooting
“Opening browser for authentication” hangs
Solutions:
- Check your default browser is working
- Try a different browser
- Check for popup blockers
- Ensure you have internet connectivity
Secret created but token fails
Causes:
- Secret hasn’t propagated yet (wait 30 seconds)
- Wrong tenant ID in profile
- App permissions not configured correctly
Solutions:
- Wait and retry
- Verify profile settings match the app registration
- Check app has required API permissions in Azure Portal
Can’t find the created secret in Azure Portal
The secret appears under:
- Azure Portal → Azure Active Directory
- App registrations → Your app
- Certificates & secrets → Client secrets
Look for the EAC-EXP-DD-MMM-YY name.
See Also
- App Discovery - Discover apps and create profiles
- Managing Profiles - Full profile management guide
- Certificate Authentication - Alternative to secrets
- Security Best Practices - Securing your setup