Needed files
How to create the Azure Function
In the Azure Portal create a new resource group
Create a new function locally
func init az_functions --python -m V1 cd az_functions
Edit the
requirements.txt
file generated and append the following to itcertifi==2023.5.7 charset-normalizer==3.1.0 databricks-sdk==0.1.8 idna==3.4 requests==2.28.2 urllib3==1.26.16
Create the storage account needed for the function
az storage account create --name lhmgrant --resource-group <YOUR_RESOURCE_GROUP> -sku Standard_LRS
Create a new function based on the
Timer trigger
templatefunc new --name lhm-grant --template "Timer trigger"
Download the
python_provisioning.py
andazure_main.py
into the new function directorylhm-grant
Edit
azure_main.py
and provide needed information for the grant codeChange the cron schedule inside
lhm-grant/function.json
Change the
lhm-grant/__init__.py
file to call the grant functionimport datetime import logging import azure.functions as func from .azure_main import main as m def main(mytimer: func.TimerRequest) -> None: m()
Create the Azure Portal FunctionApp
az functionapp create --resource-group <YOUR_RESOURCE_GROUP> --runtime python --runtime-version 3.7 --functions-version 4 --name lhm-grant --os-type linux --storage-account lhmgrant --consumption-plan-location <CONSUMPTION_PLAN_LOCATION>
Publish the app
func azure functionapp publish lhm-grant
0 Comments