[Python] Cannot push Python to azure-functions

Discussão em 'Python' iniciado por Stack, Agosto 11, 2025.

  1. Stack

    Stack Membro Participativo

    I have created an azure-functions vie template in VS-Code, wich hast the usual look like below:

    import azure.functions as func
    import logging

    app = func.FunctionApp(http_auth_level=func.AuthLevel.FUNCTION)

    @app.route(route="CrossSelling")
    def CrossSelling(req: func.HttpRequest) -> func.HttpResponse:
    logging.info('Python HTTP trigger function processed a request.')

    name = req.params.get('name')
    if not name:
    try:
    req_body = req.get_json()
    except ValueError:
    pass
    else:
    name = req_body.get('name')

    if name:
    return func.HttpResponse(f"Hello, {name}. This HTTP triggered function executed successfully.")
    else:
    return func.HttpResponse(
    "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.",
    status_code=200
    )```

    When I push it to my function app (consumption based option), everything works fine and my function appears under the functions Apps menu:


    [![enter image description here][1]][1]

    But when I add a tiny change to the code like:

    [![enter image description here][2]][2]

    It says that everything worked fine:

    [![enter image description here][3]][3]

    But in azure, there is no function appearing:

    [![enter image description here][4]][4]


    [1]: https://i.sstatic.net/WBRQt7wX.png
    [2]: https://i.sstatic.net/19QrFoJ3.png
    [3]: https://i.sstatic.net/wimWSjyY.png
    [4]: https://i.sstatic.net/vT5uQcUo.png

    Continue reading...

Compartilhe esta Página