Cannot add connection string in app service

Cale Lacson 0 Reputation points
2025-06-19T04:24:00.6166667+00:00

I cannot add connection string in app service > environment variable > connection string.
This issue is not existing on our other app service.

according to logs:

"statusCode": "BadRequest",
        "serviceRequestId": null,
        "statusMessage": "{\"Code\":\"BadRequest\",\"Message\":\"The parameter properties has an invalid value.\",\"Target\":null,\"Details\":[{\"Message\":\"The parameter properties has an invalid value.\"},{\"Code\":\"BadRequest\"},{\"ErrorEntity\":{\"ExtendedCode\":\"51008\",\"MessageTemplate\":\"The parameter {0} has an invalid value.\",\"Parameters\":[\"properties\"],\"Code\":\"BadRequest\",\"Message\":\"The parameter properties has an invalid value.\"}}],\"Innererror\":null}",

screenshot

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Laxman Reddy Revuri 5,395 Reputation points Microsoft External Staff Moderator
    2025-06-19T05:15:28.7333333+00:00

    Hi @Cale Lacson
    You're encountering a BadRequest error while adding a connection string in your App Service. This usually means there's a problem with the input format or missing/invalid fields.

    Ensure that the JSON you are entering for the connection string is properly formatted. Here's a quick template for what it should look like:

    
      {
      "name": "your-connection-string-name",
      "value": "your-connection-string-value",
     "type": "SQLServer", // or whichever type you're using
        "slotSetting": false
      }
    
    
    • Navigate to your App Service in the Azure portal.

    Go to Settings > Environment variables > Connection strings.

    • Select Add and enter the name and value correctly.
      Avoid using invalid characters in the name (like : or spaces).

    If the Azure portal method isn't working, you can try using the Azure CLI to set the connection string:

    az webapp config connection-string set --resource-group your-resource-group --name your-app-name --connection-string-type SQLAzure --settings your-connection-string-name="your-connection-string-value"
    

    Make sure that your account has the necessary permissions to modify the App Service settings. You might need to be an owner or contributor in the relevant resource group.
    https://learn.microsoft.com/en-us/azure/app-service/configure-common?tabs=portal

    0 comments No comments

Your answer

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