Retrieving connection/parameter values from environment unreliable in Azure Logic Apps Standard?

Veli-Jussi Raitila 386 Reputation points
2024-10-01T11:04:29.6266667+00:00

I have trouble fetching values (using the @appsetting() expression) from environment variables to parameters.json and connections.json in Azure Logic Apps Standard. I ran into an issue with the SQL trigger when relying on this approach. Is this normal?

STEPS TO REPRODUCE

  1. Create a test database with a test table - adding the necessary permissions for a logic app instance to said database (must be able to read and create tables)
  2. Configure the SQL database name and server name into environment variables
  3. Specify a SQL connection in the connections.json. Something like:
{
  "serviceProviderConnections": {
    "sql": {
      "parameterValues": {
        "serverName": "@appsetting('test_sql_server_name')",
        "databaseName": "@appsetting('test_sql_db_name')",
        "authProvider": {
          "Type": "ManagedServiceIdentity"
        }
      },
      "serviceProvider": {
        "id": "/serviceProviders/sql"
      },
      "displayName": "Test-SQL"
    }
  }
}
  1. Add a SQL 'When a row if modified' in-app trigger to a workflow
  2. Insert/update row in the test table

EXPECTED RESULTS

  • The SQL trigger fires normally

ACTUAL RESULTS

  • The SQL trigger does not fire. Furthermore, there is no indication of an error anywhere

PS. There is a limitation in the V2 telemetry when a trigger fails. This seems like an additional oversight. Switching to the V1 telemetry does reveal an exception and an "Access denied" error. But rather than a permissions problem, it looks like the trigger is unable to expand the @appsetting() expression. The trigger (+ creating the necessary tracking tables in the az_func schema) does work when typing the literal server and database names into parameterValues instead.

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,187 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 28,381 Reputation points Microsoft Employee
    2024-10-03T01:07:21.6566667+00:00

    Hi @Veli-Jussi Raitila

    I think what you're looking for is Parameters, see Create parameters for workflow inputs - Azure Logic Apps | Microsoft Learn. Create the parameter and reference that parameter in your connector. Using the JSON above, you would replace @appsetting('test_sql_server_name') with @parameters('test_sql_server_name').


    EDIT 23 Oct 2024 The product team has discovered a bug that prevented usage of @appsetting('<setting name>'). It was isolated to the SQL MI/AAD trigger where it wasn't resolving correctly. The fix is pending and will be deployed (no ETA) soon.


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.