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
resource "azurerm_security_center_contact" "example" {
email = "fred@benco.io"
phone = "+1-555-555-5555"
alert_notifications = true
alerts_to_admins = true
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
resource "azurerm_security_center_contact" "contact" {
email = var.contact_email
phone = var.contact_phone
alert_notifications = true
alerts_to_admins = true
resource "azurerm_security_center_contact" "main" {
alert_notifications = true
alerts_to_admins = true
email = var.security_contact_email
phone = var.security_contact_phone
}
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.
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.
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.
Parameters
-
alert_notifications
required - bool -
alerts_to_admins
required - bool -
email
required - string -
id
optional computed - string -
phone
optional - string -
timeouts
single block
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.
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.
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
"type": "Microsoft.Security/securityContacts",
"deploymentScope": "Subscription",
"existenceScope": "Subscription",
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/fb1c8493-542b-48eb-b624-b4c8fea62acd"
],
"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"
"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"
"type": "Microsoft.Security/securityContacts",
"deploymentScope": "Subscription",
"existenceScope": "Subscription",
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/fb1c8493-542b-48eb-b624-b4c8fea62acd"
],
"type": "Microsoft.Security/securityContacts",
"apiVersion": "2017-08-01-preview",
"name": "valid",
"properties": {
"alertNotifications": "On",
"alertsToAdmins": "Off",
"type": "Microsoft.Security/securityContacts",
"deploymentScope": "Subscription",
"existenceScope": "Subscription",
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/fb1c8493-542b-48eb-b624-b4c8fea62acd"
],
"type": "Microsoft.Security/securityContacts",
"existenceCondition": {
"allOf": [
{
"field": "Microsoft.Security/securityContacts/email",
"equals": "[parameters ('emailSecurityContact')]"
"type": "Microsoft.Security/securityContacts",
"properties": {
"alertNotifications": "On"
}
}
},
"type": "Microsoft.Security/securityContacts",
"properties": {
"email": "chen@contoso.com",
"alertNotifications": "On",
"alertsToAdmins": "On"
}
"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.