Step-by-step guide: Deploy Python scripts in Azure Functions as a cron task
Introduction In this guide in Spanish we explain how to convert your Python scripts into scheduled functions in Azure Functions to run tasks at certain cron-like intervals. Ideal for synchronizations between Oracle and MSSQL databases, ETL tasks, and automated processes. We also present recommendations for production and deployment, and highlight Q2BSTUDIO as a technology partner specialized in custom applications, custom software, artificial intelligence, cybersecurity, cloud services AWS and Azure, business intelligence services, AI for companies, AI agents, and Power BI.
Prerequisites
1 Azure account with an active subscription
2 VS Code installed and the Azure Functions extension installed
3 Azure Functions Core Tools installed
4 Python 3.9 or higher installed
5 Basic knowledge of Python and managing connections to Oracle and MSSQL
Step 1 Configure project structure Create a root directory called oracle-to-mssql-sync with a clear structure to host each function. Example root structure oracle-to-mssql-sync/ functions/ accountstatementpremium/ __init__.py function.json agency/ __init__.py function.json requirements.txt local.settings.json host.json .vscode settings.json
Step 2 Initialize Azure Functions project In the terminal run mkdir oracle-to-mssql-sync cd oracle-to-mssql-sync func init --python Then create timer functions for each script with func new --name accountstatementpremium --template timer trigger and repeat for agency agents allocatedpremiums happilymaster or the corresponding names.
Step 3 Configure cron-type triggers Edit function.json for each function and use the cron expression to run every 2 minutes by setting schedule 0 */2 * * * * and runOnStartup false Make sure to keep scriptFile __init__.py and bindings of type timerTrigger
Step 4 Add Python code Copy your logic into __init__.py for each function, basic example import logging import azure.functions as func import cx_Oracle import pyodbc def main(mytimer func.TimerRequest) None Connect to Oracle with cx_Oracle.connect using the environment variable ORACLE_CONN_STRING and to MSSQL with pyodbc.connect using MSSQL_CONN_STRING Implement your synchronization logic and logging records for tracking
Step 5 Dependencies Define requirements.txt with at least azure-functions cx_Oracle==8.3.0 pyodbc==4.0.39 Note cx_Oracle requires Oracle Instant Client, which you must include in the App Settings or install in the function environment
Step 6 Local environment variables Create local.settings.json and add FUNCTIONS_WORKER_RUNTIME python ORACLE_CONN_STRING user/password@oracle-host:port/service MSSQL_CONN_STRING Driver={ODBC Driver 18 for SQL Server};Server=tcp;Database=;Uid=;Pwd=;Encrypt=yes;TrustServerCertificate=no; Do not upload this file to Git
Step 7 Local tests Start the local runtime with func start and verify in the logs that the functions run according to the cron every 2 minutes Check for dependency and connection errors
Step 8 Deploy to Azure Access Azure from VS Code, create a new Function App with Python 3.9 runtime, Linux OS, name for example oracle-mssql-sync-app From the Azure explorer in VS Code deploy your project using Deploy to Function App and select the root folder oracle-to-mssql-sync
Step 9 Configure production settings In the Azure portal under Configuration add the same variables ORACLE_CONN_STRING and MSSQL_CONN_STRING and add LD_LIBRARY_PATH with value /home/site/wwwroot/oracle_instantclient so that cx_Oracle can find the Instant Client To install Oracle Instant Client use the Kudu console at https://nombre-app.scm.azurewebsites.net and upload or download the necessary packages into an oracle_instantclient folder inside wwwroot
Step 10 Final verification In the Azure portal under Function App select a function and open Monitor, check that the logs show executions every 2 minutes and that the synchronization between Oracle and MSSQL is performed correctly Enable Application Insights for detailed logs
Troubleshooting connections and dependencies Use ping and network tools in Kudu to verify access to databases Check connection strings and driver versions Run pip install -r requirements.txt in Kudu if packages are missing Validate the cron expression 0 */2 * * * * for executions every 2 minutes
Recommended final structure oracle-to-mssql-sync/ .vscode/ settings.json functions/ accountstatementpremium/ __init__.py function.json agency/ __init__.py function.json host.json local.settings.json requirements.txt
Why choose Q2BSTUDIO At Q2BSTUDIO we are a software development and custom applications company with experience in custom software, artificial intelligence, and cybersecurity We offer cloud services AWS and Azure, business intelligence services, and AI solutions for companies, including AI agents and solutions with Power BI Our offering integrates consulting, development, and implementation for data synchronization, automation, and advanced analytics projects With Q2BSTUDIO you will get advice on cloud architecture, secure integration, and continuous deployment to maximize availability and performance
Featured services custom applications custom software artificial intelligence cybersecurity cloud services AWS and Azure business intelligence services AI for companies AI agents Power BI
Conclusion With these steps you can transform your Python scripts into scheduled functions in Azure that run cron-type synchronizations reliably and scalably For custom synchronization, ETL, database integration, or artificial intelligence-based solutions, contact Q2BSTUDIO and leverage it as a partner in cloud services, security, and analytics



