AI-200
Azure
Back to Deploy and operate containers on Azure App Service

Configure app settings for Azure container environments

Connection strings

Overview

Connection strings are a specialized form of app settings for database connectivity. App Service prefixes connection-string environment variables with a type identifier.

Short notes (exam revision)

TypeEnv var prefix
SQL ServerSQLCONNSTR_
SQL AzureSQLAZURECONNSTR_
MySQLMYSQLCONNSTR_
PostgreSQLPOSTGRESQLCONNSTR_
CustomCUSTOMCONNSTR_
  • Example: name DefaultConnection + type SQLAzureSQLAZURECONNSTR_DefaultConnection
  • For Python / Node.js / non-.NET: prefer normal app settings — prefixes add complexity with no benefit

Configure a connection string

Azure CLI
az webapp config connection-string set \
  --resource-group myResourceGroup \
  --name myDocumentProcessor \
  --connection-string-type SQLAzure \
  --settings DefaultConnection="Server=myserver.database.windows.net;Database=mydb;..."

When to use what

RuntimePrefer
.NET (expects prefixed vars)Connection strings
Python, Node.js, similarApp settings for DB URLs

Use cases

  • ASP.NET app reading SQLAZURECONNSTR_DefaultConnection
  • FastAPI AI service: store DATABASE_URL as a plain app setting instead

Exam tips

  • Memorize the prefix table (especially SQLAZURECONNSTR_)
  • Know that non-.NET usually should use app settings, not connection strings

Learn more