App Service Authentication Is Not Set
- Query id: 83130a07-235b-4a80-918b-a370e53f0bd9
- Query name: App Service Authentication Is Not Set
- Platform: AzureResourceManager
- Severity: Info
- Category: Access Control
- URL: Github
Description¶
Azure App Service should have App Service Authentication set
Documentation
Code samples¶
Code samples with security vulnerabilities¶
Positive test num. 1 - json file
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "appServicePlan1",
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2018-02-01",
"location": "[resourceGroup().location]",
"sku": {
"name": "F1",
"capacity": 1
},
"tags": {
"displayName": "appServicePlan1"
},
"properties": {
"name": "appServicePlan1"
}
},
{
"name": "webApp1",
"type": "Microsoft.Web/sites",
"apiVersion": "2020-12-01",
"location": "[resourceGroup().location]",
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/appServicePlan1')]": "Resource",
"displayName": "webApp1"
},
"resources": [
{
"type": "config",
"name": "authsettings",
"apiVersion": "2020-12-01",
"dependsOn": [ "[resourceId('Microsoft.Web/sites', 'webApp1')]" ],
"properties": {
"enabled": false
}
}
],
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
],
"properties": {
"name": "webApp1",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
}
}
]
}
Positive test num. 2 - json file
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "appServicePlan1",
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2018-02-01",
"location": "[resourceGroup().location]",
"sku": {
"name": "F1",
"capacity": 1
},
"tags": {
"displayName": "appServicePlan1"
},
"properties": {
"name": "appServicePlan1"
}
},
{
"name": "webApp1",
"type": "Microsoft.Web/sites",
"apiVersion": "2020-12-01",
"location": "[resourceGroup().location]",
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/appServicePlan1')]": "Resource",
"displayName": "webApp1"
},
"resources": [
{
"type": "config",
"name": "authsettings",
"apiVersion": "2020-12-01",
"dependsOn": [ "[resourceId('Microsoft.Web/sites', 'webApp1')]" ],
"properties": {
"alwaysOn": true
}
}
],
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
],
"properties": {
"name": "webApp1",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
}
}
]
}
Positive test num. 3 - json file
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "appServicePlan1",
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2018-02-01",
"location": "[resourceGroup().location]",
"sku": {
"name": "F1",
"capacity": 1
},
"tags": {
"displayName": "appServicePlan1"
},
"properties": {
"name": "appServicePlan1"
}
},
{
"name": "webApp1",
"type": "Microsoft.Web/sites",
"apiVersion": "2020-12-01",
"location": "[resourceGroup().location]",
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/appServicePlan1')]": "Resource",
"displayName": "webApp1"
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
],
"properties": {
"name": "webApp1",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
}
},
{
"type": "Microsoft.Web/sites/config",
"name": "webApp1/authsettings",
"apiVersion": "2020-12-01",
"dependsOn": [ "[resourceId('Microsoft.Web/sites', 'webApp1')]" ],
"properties": {
"enabled": false
}
}
]
}
Positive test num. 4 - json file
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "appServicePlan1",
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2018-02-01",
"location": "[resourceGroup().location]",
"sku": {
"name": "F1",
"capacity": 1
},
"tags": {
"displayName": "appServicePlan1"
},
"properties": {
"name": "appServicePlan1"
}
},
{
"name": "webApp1",
"type": "Microsoft.Web/sites",
"apiVersion": "2020-12-01",
"location": "[resourceGroup().location]",
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/appServicePlan1')]": "Resource",
"displayName": "webApp1"
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
],
"properties": {
"name": "webApp1",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
}
},
{
"type": "Microsoft.Web/sites/config",
"name": "webApp1/authsettings",
"apiVersion": "2020-12-01",
"dependsOn": [ "[resourceId('Microsoft.Web/sites', 'webApp1')]" ],
"properties": {
"alwaysOn": false
}
}
]
}
Positive test num. 5 - json file
{
"properties": {
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "appServicePlan1",
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2018-02-01",
"location": "[resourceGroup().location]",
"sku": {
"name": "F1",
"capacity": 1
},
"tags": {
"displayName": "appServicePlan1"
},
"properties": {
"name": "appServicePlan1"
}
},
{
"name": "webApp1",
"type": "Microsoft.Web/sites",
"apiVersion": "2020-12-01",
"location": "[resourceGroup().location]",
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/appServicePlan1')]": "Resource",
"displayName": "webApp1"
},
"resources": [
{
"type": "config",
"name": "authsettings",
"apiVersion": "2020-12-01",
"dependsOn": [ "[resourceId('Microsoft.Web/sites', 'webApp1')]" ],
"properties": {
"enabled": false
}
}
],
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
],
"properties": {
"name": "webApp1",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
}
}
],
"outputs": {}
},
"parameters": {}
},
"kind": "template",
"type": "Microsoft.Blueprint/blueprints/artifacts",
"name": "myTemplate"
}
Positive test num. 6 - json file
{
"properties": {
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "appServicePlan1",
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2018-02-01",
"location": "[resourceGroup().location]",
"sku": {
"name": "F1",
"capacity": 1
},
"tags": {
"displayName": "appServicePlan1"
},
"properties": {
"name": "appServicePlan1"
}
},
{
"name": "webApp1",
"type": "Microsoft.Web/sites",
"apiVersion": "2020-12-01",
"location": "[resourceGroup().location]",
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/appServicePlan1')]": "Resource",
"displayName": "webApp1"
},
"resources": [
{
"type": "config",
"name": "authsettings",
"apiVersion": "2020-12-01",
"dependsOn": [ "[resourceId('Microsoft.Web/sites', 'webApp1')]" ],
"properties": {
"alwaysOn": true
}
}
],
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
],
"properties": {
"name": "webApp1",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
}
}
],
"outputs": {}
},
"parameters": {}
},
"kind": "template",
"type": "Microsoft.Blueprint/blueprints/artifacts",
"name": "myTemplate"
}
Positive test num. 7 - json file
{
"properties": {
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "appServicePlan1",
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2018-02-01",
"location": "[resourceGroup().location]",
"sku": {
"name": "F1",
"capacity": 1
},
"tags": {
"displayName": "appServicePlan1"
},
"properties": {
"name": "appServicePlan1"
}
},
{
"name": "webApp1",
"type": "Microsoft.Web/sites",
"apiVersion": "2020-12-01",
"location": "[resourceGroup().location]",
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/appServicePlan1')]": "Resource",
"displayName": "webApp1"
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
],
"properties": {
"name": "webApp1",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
}
},
{
"type": "Microsoft.Web/sites/config",
"name": "webApp1/authsettings",
"apiVersion": "2020-12-01",
"dependsOn": [ "[resourceId('Microsoft.Web/sites', 'webApp1')]" ],
"properties": {
"enabled": false
}
}
],
"outputs": {}
},
"parameters": {}
},
"kind": "template",
"type": "Microsoft.Blueprint/blueprints/artifacts",
"name": "myTemplate"
}
Positive test num. 8 - json file
{
"properties": {
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "appServicePlan1",
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2018-02-01",
"location": "[resourceGroup().location]",
"sku": {
"name": "F1",
"capacity": 1
},
"tags": {
"displayName": "appServicePlan1"
},
"properties": {
"name": "appServicePlan1"
}
},
{
"name": "webApp1",
"type": "Microsoft.Web/sites",
"apiVersion": "2020-12-01",
"location": "[resourceGroup().location]",
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/appServicePlan1')]": "Resource",
"displayName": "webApp1"
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
],
"properties": {
"name": "webApp1",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
}
},
{
"type": "Microsoft.Web/sites/config",
"name": "webApp1/authsettings",
"apiVersion": "2020-12-01",
"dependsOn": [ "[resourceId('Microsoft.Web/sites', 'webApp1')]" ],
"properties": {
"alwaysOn": false
}
}
],
"outputs": {}
},
"parameters": {}
},
"kind": "template",
"type": "Microsoft.Blueprint/blueprints/artifacts",
"name": "myTemplate"
}
Code samples without security vulnerabilities¶
Negative test num. 1 - json file
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "appServicePlan1",
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2018-02-01",
"location": "[resourceGroup().location]",
"sku": {
"name": "F1",
"capacity": 1
},
"tags": {
"displayName": "appServicePlan1"
},
"properties": {
"name": "appServicePlan1"
}
},
{
"name": "webApp1",
"type": "Microsoft.Web/sites",
"apiVersion": "2020-12-01",
"location": "[resourceGroup().location]",
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/appServicePlan1')]": "Resource",
"displayName": "webApp1"
},
"resources": [
{
"type": "config",
"name": "authsettings",
"apiVersion": "2020-12-01",
"dependsOn": [ "[resourceId('Microsoft.Web/sites', 'webApp1')]" ],
"properties": {
"enabled": true
}
}
],
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
],
"properties": {
"name": "webApp1",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
}
}
]
}
Negative test num. 2 - json file
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "appServicePlan1",
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2018-02-01",
"location": "[resourceGroup().location]",
"sku": {
"name": "F1",
"capacity": 1
},
"tags": {
"displayName": "appServicePlan1"
},
"properties": {
"name": "appServicePlan1"
}
},
{
"name": "webApp1",
"type": "Microsoft.Web/sites",
"apiVersion": "2020-12-01",
"location": "[resourceGroup().location]",
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/appServicePlan1')]": "Resource",
"displayName": "webApp1"
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
],
"properties": {
"name": "webApp1",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
}
},
{
"type": "Microsoft.Web/sites/config",
"name": "webApp1/authsettings",
"apiVersion": "2020-12-01",
"dependsOn": [ "[resourceId('Microsoft.Web/sites', 'webApp1')]" ],
"properties": {
"enabled": true
}
}
]
}
Negative test num. 3 - json file
{
"properties": {
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "appServicePlan1",
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2018-02-01",
"location": "[resourceGroup().location]",
"sku": {
"name": "F1",
"capacity": 1
},
"tags": {
"displayName": "appServicePlan1"
},
"properties": {
"name": "appServicePlan1"
}
},
{
"name": "webApp1",
"type": "Microsoft.Web/sites",
"apiVersion": "2020-12-01",
"location": "[resourceGroup().location]",
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/appServicePlan1')]": "Resource",
"displayName": "webApp1"
},
"resources": [
{
"type": "config",
"name": "authsettings",
"apiVersion": "2020-12-01",
"dependsOn": [ "[resourceId('Microsoft.Web/sites', 'webApp1')]" ],
"properties": {
"enabled": true
}
}
],
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
],
"properties": {
"name": "webApp1",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
}
}
],
"outputs": {}
},
"parameters": {}
},
"kind": "template",
"type": "Microsoft.Blueprint/blueprints/artifacts",
"name": "myTemplate"
}
Negative test num. 4 - json file
{
"properties": {
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"name": "appServicePlan1",
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2018-02-01",
"location": "[resourceGroup().location]",
"sku": {
"name": "F1",
"capacity": 1
},
"tags": {
"displayName": "appServicePlan1"
},
"properties": {
"name": "appServicePlan1"
}
},
{
"name": "webApp1",
"type": "Microsoft.Web/sites",
"apiVersion": "2020-12-01",
"location": "[resourceGroup().location]",
"tags": {
"[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web/serverfarms/appServicePlan1')]": "Resource",
"displayName": "webApp1"
},
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
],
"properties": {
"name": "webApp1",
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', 'appServicePlan1')]"
}
},
{
"type": "Microsoft.Web/sites/config",
"name": "webApp1/authsettings",
"apiVersion": "2020-12-01",
"dependsOn": [ "[resourceId('Microsoft.Web/sites', 'webApp1')]" ],
"properties": {
"enabled": true
}
}
],
"outputs": {}
},
"parameters": {}
},
"kind": "template",
"type": "Microsoft.Blueprint/blueprints/artifacts",
"name": "myTemplate"
}