Prerequisites
- A Microsoft Entra ID tenant
- Permissions to create an app registration in your tenant
- Access to a web browser on the machine running Terraform
Setup
Create App Registration
Configure Authentication
- Under “Authentication”, add a platform configuration for “Web”
- Add a redirect URI (e.g.,
http://localhost:8888) - Ensure “Access tokens” and “ID tokens” are checked under “Implicit grant and hybrid flows”
Provider Configuration
- Environment Variables (Recommended)
- Terraform Configuration
Usage Workflow
When you run Terraform with interactive browser authentication:Configuration Options
Login Hint
You can provide ausername to pre-populate the login page:
Redirect URL
Theredirect_url must exactly match one of the redirect URIs configured in your app registration:
Use Cases
Interactive browser authentication is ideal for:Local Development
Rapid development and testing on your local machine
Testing
Testing and troubleshooting configurations
First-time Setup
Initial setup and configuration
User-specific Permissions
Scenarios requiring user-specific permissions
Security Considerations
Security Notes
- This method grants permissions based on the authenticated user’s privileges
- For automated processes, use client secret, certificate, or OIDC authentication
- The default token lifetime is one hour
- For shared machines, be cautious as the browser may retain cookies
- Always log out when finished
Troubleshooting
Browser doesn't open
Browser doesn't open
The provider may not be able to launch a browser automatically. Manually open the browser and navigate to the URL displayed in the logs.
Redirect error
Redirect error
Ensure the redirect URL in your configuration exactly matches the one in your app registration, including protocol (http/https) and any trailing slashes.
Permission denied
Permission denied
Ensure you’ve granted admin consent for the required permissions in your app registration.
Browser automation blocked
Browser automation blocked
Some security tools may block automated browser launching. In these cases, use device code authentication instead.
