how to fix the broken connection string in local.settings.json file on azure function app? - Stack Overflow

admin2025-05-01  0

This is the content inside local.settings.json file. here the password have special characterslike (=,%) which i suspect is the issue.

{
    "IsEncrypted": false,
    "Values": {
        "AzureWebJobsStorage": "",
        "FUNCTIONS_WORKER_RUNTIME": "python",
        "SQLConnectionString": "Server=tcp:test.database.windows,1433;Database=<>;User Id=testuser;Password="
    }
}

I have a sql trigger in the main function_app.py file. Also, is there any way i can not hardcode these values .

I have tried using urllib.parse to encode the password for use. I've configured an Azure Key Vault, and a function generates this connection string but couldn't use it . How do I pass it in here?"

This is the content inside local.settings.json file. here the password have special characterslike (=,%) which i suspect is the issue.

{
    "IsEncrypted": false,
    "Values": {
        "AzureWebJobsStorage": "",
        "FUNCTIONS_WORKER_RUNTIME": "python",
        "SQLConnectionString": "Server=tcp:test.database.windows.net,1433;Database=<>;User Id=testuser;Password="
    }
}

I have a sql trigger in the main function_app.py file. Also, is there any way i can not hardcode these values .

I have tried using urllib.parse to encode the password for use. I've configured an Azure Key Vault, and a function generates this connection string but couldn't use it . How do I pass it in here?"

Share Improve this question edited Jan 7 at 11:59 Kranthi Pakala 1,4326 silver badges12 bronze badges asked Jan 2 at 14:51 sudipsudip 12 bronze badges 1
  • Did you try anything else – RithwikBojja Commented Jan 3 at 8:03
Add a comment  | 

1 Answer 1

Reset to default 0

I have a sql trigger in the main function_app.py file. Also, is there any way i can not hardcode these values . I've configured an Azure Key Vault, and a function generates this connection string but couldn't use it . How do I pass it in here?"

You can store it in Environment variables Section as below:

Or you can store it in Key Vault and bring it to function app by pulling the reference and storing it as

@Microsoft.KeyVault(VaultName=keyvaultname;SecretName=keyname) and then pull the reference:

For further information on connection between keyvault and function app refer SO-Thread1 and SO-Thread2.

Or you can also use App configuration service and get it to function app using @Microsoft.AppConfiguration(Endpoint=https://rithwik98.azconfig.io; Key=test)

If you do not want to give password, you can use managed identity or client credentials and give the role to it in sql server to access from function app

转载请注明原文地址:http://anycun.com/QandA/1746111809a91832.html