The app settings in appsettings.json
will not be automatically deployed to App Settings in the Azure Portal. Instead, you can use Azure CLI or Azure PowerShell to deploy the app settings to App Settings.
I have tried with the same approach that you provided in the above MS doc in python.
Firstly added new application settings in azure portal and setup name
and value
.

Created an appsettings.json
file in the root directory of the function app.

Then updated __init.py__
as below.
import configparser
import os
config = configparser.ConfigParser()
config.read('appsettings.json')
my_setting = os.environ["MySetting"]
connection_string = os.environ["ConnectionString"]
Then, Iam unable to run the function with following error below.

I have checked mysetting
in environmental variable but, no luck.
Try the below one in your environment.
- Add your settings to the App Configuration store. Install the Azure App Configuration Python library by running
pip install azure-appconfiguration
.

- Set an environment variable named
AZURE_APPCONFIG_CONNECTION_STRING
with the connection string of your App Configuration store.
from azure.appconfiguration import AzureAppConfigurationClient
from azure.functions import _app_name
connection_string = os.environ.get("AZURE_APPCONFIG_CONNECTION_STRING")
app_config_client = AzureAppConfigurationClient.from_connection_string(connection_string)
def main(req: func.HttpRequest) -> func.HttpResponse:
setting = app_config_client.get_configuration_setting(key="setting_key")
return func.HttpResponse(f"Setting value: {setting.value}")
Check for further reference that may help to you.