Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

Version 1 Next »

Needed files

How to create the Azure Function

  1. In the Azure Portal create a new resource group

  2. Create a new function locally

    func init az_functions --python -m V1
    cd az_functions
  3. Edit the requirements.txt file generated and append the following to it

    certifi==2023.5.7
    charset-normalizer==3.1.0
    databricks-sdk==0.1.8
    idna==3.4
    requests==2.28.2
    urllib3==1.26.16
  4. Create the storage account needed for the function

    az storage account create --name lhmgrant --resource-group <YOUR_RESOURCE_GROUP> -sku Standard_LRS
  5. Create a new function based on the Timer trigger template

    func new --name lhm-grant --template "Timer trigger"
  6. Download the python_provisioning.py and azure_main.py into the new function directory lhm-grant

  7. Edit azure_main.py and provide needed information for the grant code

  8. Change the cron schedule inside lhm-grant/function.json

  9. Change the lhm-grant/__init__.py file to call the grant function

    import datetime
    import logging
    
    import azure.functions as func
    from .azure_main import main as m
    
    
    def main(mytimer: func.TimerRequest) -> None:
        m()
  10. 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>
  11. Publish the app

    func azure functionapp publish lhm-grant

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.