Administrator Configuration Guide¶
This guide explains how to configure administrator access for the IoT Hub Portal.
Default Admin User Behavior¶
The IoT Hub Portal has built-in support for automatically granting administrator privileges to users. This happens in two scenarios:
1. First User (Automatic)¶
When the portal is first deployed and has no users, the first user to log in will automatically be granted full administrator privileges. This ensures that there is always at least one administrator who can manage the system.
2. Configured Global Admins¶
You can pre-configure specific email addresses that should automatically receive administrator privileges when they first log in to the portal.
Configuration¶
GlobalAdminEmails Setting¶
Add the GlobalAdminEmails configuration setting to specify which users should automatically receive administrator privileges.
Format: Comma-separated list of email addresses
Example:
Configuration Methods¶
Azure App Service Configuration¶
For Azure deployments, add this as an Application Setting:
AWS Environment Variables¶
For AWS deployments, set this as an environment variable:
| Bash | |
|---|---|
appsettings.json (Development)¶
For local development, add to your appsettings.json:
How It Works¶
- User Authentication: When a user successfully authenticates with the portal
- User Lookup: The system checks if a user record exists for their email address
- New User Creation: If no user record exists, a new user is created
- Admin Check: The system then checks if the user should be granted admin privileges by:
- Checking if this is the first user in the system (no other users exist)
- OR checking if their email address is in the
GlobalAdminEmailsconfiguration - Role Assignment: If either condition is true, the user is automatically assigned to the "Administrators" role with full ("*") scope
Administrators Role¶
The "Administrators" role is created automatically through database migrations and includes all available permissions:
- User management (read/write)
- Role management (read/write)
- Access control management (read/write)
- Device management (read/write/import/export)
- Device model management (read/write)
- Edge device management (read/write/execute)
- Edge model management (read/write)
- Device configuration management (read/write)
- Device tag management (read/write)
- Layer management (read/write)
- Planning management (read/write)
- Schedule management (read/write)
- Concentrator management (read/write)
- Dashboard access (read)
- Settings access (read)
- Ideas submission (write)
Security Considerations¶
- Email Validation: Email addresses are compared case-insensitively
- One-Time Assignment: Admin privileges are only assigned when a new user first logs in
- Persistent Access: Once assigned, admin privileges persist until manually removed
- Configuration Security: Protect your configuration files and environment variables as they control who gets admin access
- Audit Trail: All access control assignments are logged in the database
Troubleshooting¶
"Unauthorized Access" Error After Login¶
If you see an "Unauthorized Access" error after successfully logging in, it means:
- You are not the first user (someone else logged in before you)
- Your email is not in the
GlobalAdminEmailsconfiguration - You have not been assigned any roles by an existing administrator
Solution:
- Add your email address to the
GlobalAdminEmailsconfiguration - Restart the application
- Log out and log in again
- Your account should now have administrator privileges
Verifying Configuration¶
To verify your configuration is working:
- Check that the
GlobalAdminEmailssetting is present in your configuration - Check that your email address is correctly spelled in the list
- Ensure there are no extra spaces around email addresses (they are automatically trimmed)
- Check the application logs for any errors during user creation
Checking the Administrators Role¶
The "Administrators" role should be created automatically by the database migrations. If it's missing:
- Check that all database migrations have been applied
- Look for the
AddDefaultAdminRolemigration in the migrations list - If missing, the migration may need to be manually applied
Managing Administrators¶
After the initial setup, administrators can be managed through the portal's user management interface:
- Navigate to the Users section
- Select a user
- Assign or remove the "Administrators" role
- Set the appropriate scope ("*" for global access)
Best Practices¶
- Limit Admin Count: Only configure essential admin email addresses in
GlobalAdminEmails - Use Role-Based Access: For most users, assign specific roles with limited permissions rather than full admin access
- Regular Audits: Periodically review who has administrator access
- Document Admins: Keep a record of who is configured as a global admin and why
- Secure Configuration: Store configuration securely and limit access to configuration files