feat(azure): Added necessary azure components to app
Using respective credentials for both local development as well as deployment. When deployed on azure, the app authenticates with the SQL database via Entra ID (formerly active directory) and accesses other credentials via key vault as a system managed identity.
This commit is contained in:
10
app/app.py
10
app/app.py
@@ -5,6 +5,7 @@ from typing import Any, Dict, Tuple
|
||||
import dash_auth
|
||||
import pandas as pd
|
||||
from app_styles import header_style
|
||||
from config import check_credentials
|
||||
from dash import (
|
||||
Dash,
|
||||
Input,
|
||||
@@ -21,6 +22,14 @@ from dash.exceptions import PreventUpdate
|
||||
from data_chat import send_message
|
||||
from sql_utils import execute_query, test_db_connection
|
||||
|
||||
check_credentials()
|
||||
|
||||
# first connection to SQL database to mitigate long startup time
|
||||
try:
|
||||
test_db_connection()
|
||||
except Exception as e:
|
||||
print(f"Error for first connection to Azure SQL Database: {e}")
|
||||
|
||||
external_stylesheets = ["https://codepen.io/chriddyp/pen/bWLwgP.css"]
|
||||
|
||||
app = Dash(__name__, external_stylesheets=external_stylesheets)
|
||||
@@ -357,4 +366,5 @@ def run_sql_query(n_clicks: int, value: str) -> str:
|
||||
server = app.server
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("Hello!")
|
||||
app.run(debug=True)
|
||||
|
||||
Reference in New Issue
Block a user