Azure Logic Apps rely on API connections (Microsoft.Web/connections) to authenticate against external services such as SQL Server,
SharePoint, Service Bus, and others. When these connections are created using a personal or corporate user account, the connection is tied to that
individual rather than the application.
Using personal or corporate user accounts for API connections introduces several risks:
API connections should instead use service principals or managed identities, which provide scoped, rotatable, centrally managed credentials tied to the application rather than a person.
If the user account is disabled or deleted, all dependent Logic Apps will fail. Additionally, the embedded credentials may be over-privileged and difficult to rotate, increasing the blast radius of a compromise.
Use managed identity authentication by setting parameterValueType to "Alternative" instead of embedding user credentials
in parameterValues.
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "sql-connection",
"location": "[resourceGroup().location]",
"properties": {
"api": {
"id": "[subscriptionResourceId('Microsoft.Web/locations/managedApis', resourceGroup().location, 'sql')]"
},
"parameterValues": {
"server": "myserver.database.windows.net",
"database": "mydb",
"username": "john.doe@company.com",
"password": "[parameters('sqlPassword')]"
}
}
}
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "sql-connection-mi",
"location": "[resourceGroup().location]",
"properties": {
"api": {
"id": "[subscriptionResourceId('Microsoft.Web/locations/managedApis', resourceGroup().location, 'sql')]"
},
"parameterValueType": "Alternative",
"alternativeParameterValues": {
"server": "myserver.database.windows.net",
"database": "mydb"
}
}
}
Use managed identity authentication by setting parameterValueType to 'Alternative' instead of embedding user credentials
in parameterValues.
resource sqlConnection 'Microsoft.Web/connections@2016-06-01' = {
name: 'sql-connection'
location: resourceGroup().location
properties: {
api: {
id: subscriptionResourceId('Microsoft.Web/locations/managedApis', resourceGroup().location, 'sql')
}
parameterValues: {
server: 'myserver.database.windows.net'
database: 'mydb'
username: 'john.doe@company.com' // Noncompliant
password: sqlPassword
}
}
}
resource sqlConnectionMi 'Microsoft.Web/connections@2016-06-01' = {
name: 'sql-connection-mi'
location: resourceGroup().location
properties: {
api: {
id: subscriptionResourceId('Microsoft.Web/locations/managedApis', resourceGroup().location, 'sql')
}
parameterValueType: 'Alternative'
alternativeParameterValues: {
server: 'myserver.database.windows.net'
database: 'mydb'
}
}
}