Skip to content

Agent Builder setenv.sh can generate malformed Application Insights connection string #7

Description

@Danny-Shields

While working through the instructor-led / Skillable Agent Builder setup, I encountered an issue with the generated foundry/agent-builder/src/.env.

Following the documented setup:

cd foundry/agent-builder/scripts
./setenv.sh

the generated value for:

APPLICATIONINSIGHTS_CONNECTION_STRING=

contained additional text before the expected:

InstrumentationKey=...

Removing the unexpected prefix so that the value began directly with InstrumentationKey= resolved the downstream error.

The current Agent Builder scripts/setenv.sh retrieves the value using:

az monitor app-insights component show \
  --app "$APPINSIGHTS_NAME" \
  --resource-group "$RESOURCE_GROUP" \
  --query connectionString \
  -o tsv

and then writes the returned stdout directly into .env without validating it.

Interestingly, the Cohere workshop in the same repository retrieves the same connection string using the core Azure resource command:

az resource show \
  --resource-group "$RESOURCE_GROUP" \
  --name "$APP_INSIGHTS_NAME" \
  --resource-type "Microsoft.Insights/components" \
  --query properties.ConnectionString \
  --output tsv

Using the latter approach in Agent Builder would also avoid depending on the application-insights Azure CLI extension during the Skillable setenv.sh path.

Potential improvements:

  • Retrieve the connection string with az resource show, consistent with the Cohere setup.
  • Validate that a non-empty returned value begins with InstrumentationKey=.
  • Avoid silently accepting malformed CLI output into the generated .env.

I no longer have access to the temporary Skillable Azure environment, so I cannot currently reproduce the exact Azure CLI output that preceded InstrumentationKey= or perform an end-to-end test of the change. The malformed generated .env and the successful manual correction were observed during the live workshop environment.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions