Add interactive Azure AD configuration to Ubuntu install script

This commit is contained in:
nmemmert committed 2025-11-05 11:44:31 -05:00
1 parent 144adf64c4
commit 5d6a19e7ca
1 file changed
+35 -14
+35 -14
View File
@@ -84,38 +84,59 @@ log_info "Installing Python dependencies..."
pip install --upgrade pip
pip install -r requirements.txt
# Create .env file template
log_info "Creating environment configuration..."
if [ ! -f .env ]; then
cat > .env << 'EOF'
# Create .env file with Azure AD configuration
log_info "Configuring Azure AD authentication..."
echo ""
echo "=================================================================="
echo "AZURE AD CONFIGURATION REQUIRED"
echo "=================================================================="
echo "You need to provide your Azure AD app registration details."
echo "If you don't have them, follow these steps:"
echo "1. Go to https://portal.azure.com"
echo "2. Navigate to Azure Active Directory > App registrations"
echo "3. Create a new registration or use existing one"
echo "4. Note the Application (client) ID and Directory (tenant) ID"
echo "5. Create a client secret under Certificates & secrets"
echo "6. Add redirect URI: http://your-server-ip:5000/auth/callback"
echo "=================================================================="
echo ""
# Prompt for Azure AD credentials
read -p "Enter Azure AD Tenant ID (Directory ID): " AZURE_TENANT_ID
read -p "Enter Azure AD Client ID (Application ID): " AZURE_CLIENT_ID
read -s -p "Enter Azure AD Client Secret: " AZURE_CLIENT_SECRET
echo ""
read -p "Enter server IP/domain (for redirect URI) [localhost]: " SERVER_HOST
SERVER_HOST=${SERVER_HOST:-localhost}
# Create .env file with real values
cat > .env << EOF
# Microsoft Entra (Azure AD) Configuration
# Get these values from your Azure AD app registration in the Azure portal
# Azure AD Tenant ID (Directory ID)
AZURE_TENANT_ID=your-tenant-id-here
AZURE_TENANT_ID=$AZURE_TENANT_ID
# Azure AD Client ID (Application ID)
AZURE_CLIENT_ID=your-client-id-here
AZURE_CLIENT_ID=$AZURE_CLIENT_ID
# Azure AD Client Secret
AZURE_CLIENT_SECRET=your-client-secret-here
AZURE_CLIENT_SECRET=$AZURE_CLIENT_SECRET
# Azure AD Authority URL (usually https://login.microsoftonline.com/{tenant_id})
AZURE_AUTHORITY=https://login.microsoftonline.com/your-tenant-id-here
AZURE_AUTHORITY=https://login.microsoftonline.com/$AZURE_TENANT_ID
# Redirect URI (must match what's configured in Azure AD app registration)
AZURE_REDIRECT_URI=http://localhost:5000/auth/callback
AZURE_REDIRECT_URI=http://$SERVER_HOST:5000/auth/callback
# Scopes to request (openid, profile, email are common)
AZURE_SCOPES=openid profile email
# Flask Configuration
SECRET_KEY=your-secret-key-here-change-this-in-production
SECRET_KEY=$(openssl rand -hex 32)
EOF
log_warning "Created .env template. You MUST edit it with your Azure AD credentials before running the app."
else
log_info ".env file already exists"
fi
log_success "Azure AD configuration saved to .env file"
# Create systemd service file
log_info "Creating systemd service..."