Log Profile Incorrect Category
- Query id: 4d522e7b-f938-4d51-a3b1-974ada528bd3
- Query name: Log Profile Incorrect Category
- Platform: AzureResourceManager
- Severity: Medium
- Category: Observability
- URL: Github
Description¶
Log Profile Categories should be set to 'Write', 'Delete', and/or 'Action'
Documentation
Code samples¶
Code samples with security vulnerabilities¶
Postitive test num. 1 - json file
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "2.0.0.0",
"apiProfile": "2019-03-01-hybrid",
"parameters": {},
"variables": {},
"functions": [],
"resources": [
{
"name": "string",
"type": "microsoft.insights/logprofiles",
"apiVersion": "2016-03-01",
"location": "eastus",
"tags": {},
"properties": {
"storageAccountId": "storageAccountId",
"serviceBusRuleId": "serviceBusRuleId",
"locations": [
"eastus"
],
"categories": [
"Writ"
],
"retentionPolicy": {
"enabled": true,
"days": 450
}
}
}
],
"outputs": {}
}
Postitive test num. 2 - json file
{
"properties": {
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "2.0.0.0",
"apiProfile": "2019-03-01-hybrid",
"parameters": {},
"variables": {},
"functions": [],
"resources": [
{
"name": "string",
"type": "microsoft.insights/logprofiles",
"apiVersion": "2016-03-01",
"location": "eastus",
"tags": {},
"properties": {
"storageAccountId": "storageAccountId",
"serviceBusRuleId": "serviceBusRuleId",
"locations": [
"eastus"
],
"categories": [
"Writ"
],
"retentionPolicy": {
"enabled": true,
"days": 450
}
}
}
],
"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": "2.0.0.0",
"apiProfile": "2019-03-01-hybrid",
"parameters": {},
"variables": {},
"functions": [],
"resources": [
{
"name": "string",
"type": "microsoft.insights/logprofiles",
"apiVersion": "2016-03-01",
"location": "eastus",
"tags": {},
"properties": {
"storageAccountId": "storageAccountId",
"serviceBusRuleId": "serviceBusRuleId",
"locations": [
"eastus"
],
"categories": [
"Write"
],
"retentionPolicy": {
"enabled": true,
"days": 450
}
}
}
],
"outputs": {}
}
Negative test num. 2 - json file
{
"properties": {
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "2.0.0.0",
"apiProfile": "2019-03-01-hybrid",
"parameters": {},
"variables": {},
"functions": [],
"resources": [
{
"name": "string",
"type": "microsoft.insights/logprofiles",
"apiVersion": "2016-03-01",
"location": "eastus",
"tags": {},
"properties": {
"storageAccountId": "storageAccountId",
"serviceBusRuleId": "serviceBusRuleId",
"locations": [
"eastus"
],
"categories": [
"Write"
],
"retentionPolicy": {
"enabled": true,
"days": 450
}
}
}
],
"outputs": {}
},
"parameters": {}
},
"kind": "template",
"type": "Microsoft.Blueprint/blueprints/artifacts",
"name": "myTemplate"
}