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)
| Type | Env var prefix |
|---|---|
| SQL Server | SQLCONNSTR_ |
| SQL Azure | SQLAZURECONNSTR_ |
| MySQL | MYSQLCONNSTR_ |
| PostgreSQL | POSTGRESQLCONNSTR_ |
| Custom | CUSTOMCONNSTR_ |
- Example: name
DefaultConnection+ typeSQLAzure→SQLAZURECONNSTR_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
| Runtime | Prefer |
|---|---|
| .NET (expects prefixed vars) | Connection strings |
| Python, Node.js, similar | App settings for DB URLs |
Use cases
- ASP.NET app reading
SQLAZURECONNSTR_DefaultConnection - FastAPI AI service: store
DATABASE_URLas 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