Azure Security Center Contact

This page shows how to write Terraform and Azure Resource Manager for Security Center Contact and write them securely.

azurerm_security_center_contact (Terraform)

The Contact in Security Center can be configured in Terraform with the resource name azurerm_security_center_contact. The following sections describe 4 examples of how to use the resource and its parameters.

Example Usage from GitHub

test.tf#L6
resource "azurerm_security_center_contact" "example" {
  email = "fred@benco.io"
  phone = "+1-555-555-5555"

  alert_notifications = true
  alerts_to_admins    = true
main.tf#L1
resource "azurerm_security_center_contact" "contacts" {
  email = var.sec_center_email
  phone = var.sec_center_phone

  alert_notifications = var.sec_center_alert_notification
  alerts_to_admins    = var.sec_center_alerts_to_admin
securitycenter.tf#L1
resource "azurerm_security_center_contact" "contact" {
  email = var.contact_email
  phone = var.contact_phone

  alert_notifications = true
  alerts_to_admins    = true
security-centre.tf#L7
resource "azurerm_security_center_contact" "main" {
  alert_notifications = true
  alerts_to_admins = true
  email = var.security_contact_email
  phone = var.security_contact_phone
}

Review your Terraform file for Azure best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Security Best Practices for azurerm_security_center_contact

There are 2 settings in azurerm_security_center_contact that should be taken care of for security reasons. The following section explain an overview and example code.

risk-label

Ensure to enable alert notifications

It is better to configure at least one valid contact for the security center. Microsoft will inform you directly in the event of a security incident using emails.

risk-label

Ensure to set an email address for security center contact

It is better to set an email address for security center contact. Microsoft will notify you in the event of a security incident and will look to use it in cases where a prompt response is required.

Review your Azure Security Center settings

You can check if the azurerm_security_center_contact setting in your .tf file is correct in 3 min with Shisho Cloud.

Parameters

Explanation in Terraform Registry

Manages the subscription's Security Center Contact.

NOTE: Owner access permission is required.

Tips: Best Practices for The Other Azure Security Center Resources

In addition to the azurerm_security_center_subscription_pricing, Azure Security Center has the other resources that should be configured for security reasons. Please check some examples of those resources and precautions.

risk-label

azurerm_security_center_subscription_pricing

Ensure to enable alert notifications

It is better to enable Azure Defender, which is a cloud workload protection service for App Services. In addition, It is also able to analyze non-Azure resources, utilizing Azure Arc, including those on-premises and in both AWS and GCP.

Review your Azure Security Center settings

In addition to the above, there are other security points you should be aware of making sure that your .tf files are protected in Shisho Cloud.

Microsoft.Security/securityContacts (Azure Resource Manager)

The securityContacts in Microsoft.Security can be configured in Azure Resource Manager with the resource name Microsoft.Security/securityContacts. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

policy_definition_es_deploy_asc_securitycontacts.json#L48
          "type": "Microsoft.Security/securityContacts",
          "deploymentScope": "Subscription",
          "existenceScope": "Subscription",
          "roleDefinitionIds": [
            "/providers/Microsoft.Authorization/roleDefinitions/fb1c8493-542b-48eb-b624-b4c8fea62acd"
          ],
definition-securityContact.json#L13
      "type": "Microsoft.Security/securityContacts",
      "deploymentScope": "Subscription",
      "existenceScope": "Subscription",
      "roleDefinitionIds": [
        "/providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635",
        "/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
definition-securityCenterContact.json#L13
      "type": "Microsoft.Security/securityContacts",
      "deploymentScope": "Subscription",
      "existenceScope": "Subscription",
      "roleDefinitionIds": [
        "/providers/Microsoft.Authorization/roleDefinitions/8e3af657-a8ff-443c-a75c-2fe8c4bcb635",
        "/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
policy.json#L44
     "type": "Microsoft.Security/securityContacts",
     "deploymentScope": "Subscription",
     "existenceScope": "Subscription",
     "roleDefinitionIds": [
      "/providers/Microsoft.Authorization/roleDefinitions/fb1c8493-542b-48eb-b624-b4c8fea62acd"
     ],
contact_notifications_enabled_infra.json#L6
            "type": "Microsoft.Security/securityContacts",
            "apiVersion": "2017-08-01-preview",
            "name": "valid",
            "properties": {
                "alertNotifications": "On",
                "alertsToAdmins": "Off",
policy.json#L48
     "type": "Microsoft.Security/securityContacts",
     "deploymentScope": "Subscription",
     "existenceScope": "Subscription",
     "roleDefinitionIds": [
      "/providers/Microsoft.Authorization/roleDefinitions/fb1c8493-542b-48eb-b624-b4c8fea62acd"
     ],
AscEmailContact-deployIfNotExists.json#L17
        "type": "Microsoft.Security/securityContacts",
        "existenceCondition": {
          "allOf": [
            {
              "field": "Microsoft.Security/securityContacts/email",
              "equals": "[parameters ('emailSecurityContact')]"
UpdateSecurityContact_min_example.json#L9
            "type": "Microsoft.Security/securityContacts",
            "properties": {
                "alertNotifications": "On"
            }
        }
    },
CreateSecurityContact_min_example.json#L9
            "type": "Microsoft.Security/securityContacts",
            "properties": {
                "email": "chen@contoso.com",
                "alertNotifications": "On",
                "alertsToAdmins": "On"
            }
UpdateSecurityContact_full_example.json#L9
            "type": "Microsoft.Security/securityContacts",
            "properties": {
                "phone": "(214)275-4038",
                "alertNotifications": "On"
            }
        }

Frequently asked questions

What is Azure Security Center Contact?

Azure Security Center Contact is a resource for Security Center of Microsoft Azure. Settings can be wrote in Terraform.

Where can I find the example code for the Azure Security Center Contact?

For Terraform, the benc-uk/terraform-sandbox, prancer-io/prancer-terramerra and LaurentLesle/azure_terraform_blueprint_modules_security_center source code examples are useful. See the Terraform Example section for further details.

For Azure Resource Manager, the tschwarz01/tf-caf-data-management-zone, digitc1/AzLandingZonePublic and digitc1/AzLandingZonePublic source code examples are useful. See the Azure Resource Manager Example section for further details.