I have a Time Trigger Function written in Python 3.11.9 in Visual Studio code. The function runs successfully locally (using F5). When I deploy the function to the Azure portal from Visual Studio Code, it shows as "Deployment successful." in both the Output and Azure tab
However, when I go to my Function App on Azure Portal, the App files show in the function section
but my time trigger function does not shows in the overview section of the function app in the Azure Portal
When deploying from VS Code, I tried deploying from;
(which gives a slightly different output, see below)
But none of these methods were able to fix the problem of the Azure Function not showing up on my Azure Portal Function App.
here is the function code with imports(function_app.py)
import logging
import azure.functions as func
import requests
import json
from simple_salesforce import Salesforce
import pandas as pd
import csv
from flatten_json import flatten
#for extending csv file for 1 day at a time holidays
import datetime as dt
from datetime import timedelta
from urllib.parse import urlparse, urljoin
#used to save to specific folder
import os
from dotenv import load_dotenv
from shareplum import Site
from shareplum import Office365
from shareplum.site import Version
from io import BytesIO
from io import StringIO
import pandas as pd
from office365.runtime.auth.authentication_context import AuthenticationContext
from io import BytesIO
from office365.runtime.auth.client_credential import ClientCredential
from office365.sharepoint.client_context import ClientContext
#sharepoint
# import necessary modules
from shareplum import Site
import pandas as pd
from shareplum import Office365
from shareplum import Site
from shareplum.site import Version
import pandas as pd
import numpy as np
from sklearn.datasets import load_iris
from IPython.display import display
from tabulate import tabulate
from pandas import json_normalize
from office365.sharepoint.files.file import File
import pandas as pd
import io
import errno
from datetime import datetime, timedelta
from pathlib import Path
from azure.identity import DefaultAzureCredential
from azure.keyvault.secrets import SecretClient
from azure.core.exceptions import ResourceNotFoundError
from azure.storage.blob import BlobServiceClient
from azure.identity import DefaultAzureCredential
from azure.keyvault.keys import KeyClient
app = func.FunctionApp()
@app.schedule(schedule="0 */5 * * * *", arg_name="myTimer", run_on_startup=True,
use_monitor=False)
def timer_trigger(myTimer: func.TimerRequest) -> None:
if myTimer.past_due:
logging.info('The timer is past due!')
logging.info('Python timer trigger function executed.')
#full script below this, inline with function so it runs when the function runs
The modules used (requirements.txt file)
flatten-json==0.1.14
ipython==8.12.3
numpy==1.26.4
Office365-REST-Python-Client==2.5.7
pandas==2.2.0
python-dotenv==1.0.1
requests==2.31.0
scikit-learn==1.4.2
SharePlum==0.5.1
simple-salesforce==1.12.5
tabulate==0.9.0
local.settings.json file ( I have tried using "UseDevelopmentStorage=true" and not using this, both gave the same result of no function being present on Azure Portal)
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "",
"FUNCTIONS_WORKER_RUNTIME": "python",
"AzureWebJobsFeatureFlags": "EnableWorkerIndexing"
}
}
FUNCTION FAILING TO EXECUTE WITHIN PORTAL
My function is now showing in the portal and attempting to run every 5 mins (as intended) but failing to execute on each run
below is the Invocation Traces And Invocation Traces Description
Running the Query in Application Insights
Method of retrieving KeyVault Values:
keyVaultName = "<key-vault-name>"
KVUri = f"https://{keyVaultName}.vault.azure.net"
credential = DefaultAzureCredential()
client = SecretClient(vault_url=KVUri, credential=credential)
username = client.get_secret("username").value
password = client.get_secret("password").value
security_token = client.get_secret("security-token").value
domain = client.get_secret("domain").value
Access Policies blocked due to RBAC Access Configuration
These are the roles I currently have
-UPDATE
Please add all the modules in the requirements.txt
file. I have added following modules in requirements.txt
which are used in function_app.py
.
azure-functions
requests
simple-salesforce
pandas
flatten-json
python-dotenv
SharePlum
Office365-REST-Python-Client
numpy
ipython
scikit-learn
tabulate
azure-identity
azure-keyvault
azure-core
azure-storage-blob
I have same code alike you in function_app.py
file.
Update-
To get the secret value from key vault in the function app, perform the following steps-
Click Next -> Review + create
Once it is created, you will get the expected response.