function App configuration settings and files location in storage container

Omer Cohen 1 Reputation point
2022-05-26T10:22:23.183+00:00

Hi,

question 1:
I am looking to get function app configuration

205815-screen-shot-2022-05-26-at-131737.png

how is the best practice to get them from code (python/nodejs) sdk ?

question 2:
I see in your documentation they have two ways to deploy function app:

  1. local
  2. cloud

in this both ways save in different container name
in local way saved in scm-releases, and the cloud way saved in function-releases

we looked on environment variables sometimes exists SCM_RUN_FROM_PACKAGE property but we cannot relay on it
what is the way to get the container name for function app ?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
Azure Storage
Azure Storage
Globally unique resources that provide access to data management services and serve as the parent namespace for the services.
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Omer Cohen 1 Reputation point
    2022-05-26T13:10:29.677+00:00

    Hi @Bruno Lucas .
    I know how to download function app files.
    for this I need to know where function app stored in witch container name.
    and also for connection to storage account , need also connection string
    both of them saved in the image I attached in the question.

    my code is interact with function app not a function app deploy
    for that I need to know how I get function app environment variables
    and the second question is function app code is stored in storage account in containers with a zip file
    to get the zip file we need to know witch container name is there.
    how I can know where is stored?


  2. MughundhanRaveendran-MSFT 12,511 Reputation points
    2022-05-27T07:22:44.137+00:00

    @Omer Cohen ,

    Thanks for reaching out to Q&A.

    Answer for Question -1:
    You can read the app settings by following the below approach

    import logging
    import os
    import azure.functions as func

    def main(req: func.HttpRequest) -> func.HttpResponse:

    # Get the setting named 'myAppSetting'  
    my_app_setting_value = os.environ["myAppSetting"]  
    logging.info(f'My app setting value:{my_app_setting_value}')  
    

    Reference : https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-python?tabs=asgi%2Cazurecli-linux%2Capplication-level#environment-variables

    Question - 2:
    what is the way to get the container name for function app ?

    I think you are trying to get the zip file which contains the source code files. You can read the value of website_run_from_package setting, this SAS url should have the zip file name which present in the Function release container.

    I hope this helps!

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.