diff --git a/airflow-core/src/airflow/cli/commands/connection_command.py b/airflow-core/src/airflow/cli/commands/connection_command.py index 7fe430c05bfe3..6cf4378c42aa4 100644 --- a/airflow-core/src/airflow/cli/commands/connection_command.py +++ b/airflow-core/src/airflow/cli/commands/connection_command.py @@ -65,6 +65,8 @@ def _connection_mapper(conn: Connection) -> dict[str, Any]: @providers_configuration_loaded def connections_get(args): """Get a connection.""" + os.environ["_AIRFLOW_PROCESS_CONTEXT"] = "server" + try: conn = Connection.get_connection_from_secrets(args.conn_id) except AirflowNotFoundException: @@ -358,6 +360,8 @@ def _import_helper(file_path: str, overwrite: bool) -> None: @providers_configuration_loaded def connections_test(args) -> None: """Test an Airflow connection.""" + os.environ["_AIRFLOW_PROCESS_CONTEXT"] = "server" + console = AirflowConsole() if conf.get("core", "test_connection", fallback="Disabled").lower().strip() != "enabled": console.print(