[Python] Python Azure Function doesn't show functions after importing packages

Discussão em 'Python' iniciado por Stack, Abril 5, 2025.

  1. Stack

    Stack Membro Participativo

    I have an Azure Function based on Python 3.12 (same issue when I downgrade to Python 3.11). This worked fine until I imported azure.identity and azure.keyvault.secrets. Since I've added them the functions are not shown anymore in my Azure Function. When I remove them the functions will be back. It is fine when the package is loaded from the requirements.txt. The issue just happens when I add

    from azure.keyvault.secrets import SecretClient
    from azure.identity import DefaultAzureCredential


    What can be the issue what leads to that?

    Project Structure

    function_app.py

    import azure.functions as func
    from http_blueprint import bp_http
    from timer_blueprint import bp_timer

    app = func.FunctionApp()

    app.register_functions(bp_http)
    app.register_functions(bp_timer)


    http_blueprint.py

    import logging
    import azure.functions as func

    bp_http = func.Blueprint()

    @bp_http.route(route="default_template")
    def default_template(req: func.HttpRequest) -> func.HttpResponse:
    ...


    timer_blueprint.py

    import os
    import requests
    import logging
    import datetime
    import azure.functions as func
    from azure.keyvault.secrets import SecretClient
    from azure.identity import DefaultAzureCredential

    #same issue when libaries would be imported like this
    #import azure.identity
    #import azure.keyvault.secrets

    bp_timer = func.Blueprint()

    @bp_timer.timer_trigger(schedule="0 * * * * *",
    arg_name="mytimer",
    run_on_startup=True)
    def exec_timer(mytimer: func.TimerRequest) -> None:
    ...

    Continue reading...

Compartilhe esta Página