Phone Number Not Set For Security Contacts

  • Query id: 3e9fcc67-1f64-405f-b2f9-0a6be17598f0
  • Query name: Phone Number Not Set For Security Contacts
  • Platform: AzureResourceManager
  • Severity: Low
  • Category: Best Practices
  • URL: Github

Description

Microsoft.Security securityContacts should have a phone number defined
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": "2.0.0.0",
  "apiProfile": "2019-03-01-hybrid",
  "parameters": {},
  "variables": {},
  "functions": [],
  "resources": [
    {
      "name": "security contact",
      "type": "Microsoft.Security/securityContacts",
      "apiVersion": "2020-01-01-preview",
      "properties": {
        "emails": "sample@email.com",
        "alertNotifications": {
          "state": "On",
          "minimalSeverity": "High"
        },
        "notificationsByRole": {
          "state": "On",
          "roles": [
            "Owner"
          ]
        }
      }
    }
  ],
  "outputs": {}
}
Positive 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": "security contact",
          "type": "Microsoft.Security/securityContacts",
          "apiVersion": "2020-01-01-preview",
          "properties": {
            "emails": "sample@email.com",
            "alertNotifications": {
              "state": "On",
              "minimalSeverity": "High"
            },
            "notificationsByRole": {
              "state": "On",
              "roles": [
                "Owner"
              ]
            }
          }
        }
      ],
      "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": {
    "resourceGroupName": {
      "type": "string",
      "metadata": {
        "description": "Name sof resource group"
      }
    }
  },
  "variables": {},
  "functions": [],
  "resources": [
    {
      "name": "security contact",
      "type": "Microsoft.Security/securityContacts",
      "apiVersion": "2020-01-01-preview",
      "properties": {
        "emails": "sample@email.com",
        "phone": "9999999",
        "alertNotifications": {
          "state": "On",
          "minimalSeverity": "High"
        },
        "notificationsByRole": {
          "state": "On",
          "roles": [
            "Owner"
          ]
        }
      }
    }
  ],
  "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": {
        "resourceGroupName": {
          "type": "string",
          "metadata": {
            "description": "Name sof resource group"
          }
        }
      },
      "variables": {},
      "functions": [],
      "resources": [
        {
          "name": "security contact",
          "type": "Microsoft.Security/securityContacts",
          "apiVersion": "2020-01-01-preview",
          "properties": {
            "emails": "sample@email.com",
            "phone": "9999999",
            "alertNotifications": {
              "state": "On",
              "minimalSeverity": "High"
            },
            "notificationsByRole": {
              "state": "On",
              "roles": [
                "Owner"
              ]
            }
          }
        }
      ],
      "outputs": {}
    },
    "parameters": {}
  },
  "kind": "template",
  "type": "Microsoft.Blueprint/blueprints/artifacts",
  "name": "myTemplate"
}