> ## Documentation Index
> Fetch the complete documentation index at: https://cloudanix.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# No Security Contact Phone Set

### More Info:

At least one security contact phone should be set.

### Risk Level

Low

### Address

Security

### Compliance Standards

* Cloudanix Best Practice

### Triage and Remediation

<Tabs>
  <Tab title="Remediation">
    ### Remediation

    <AccordionGroup>
      <Accordion title="Using Console" defaultOpen="true">
        To remediate the "No Security Contact Phone Set" misconfiguration in Azure using the Azure console, follow these steps:

        1. Log in to the Azure portal ([https://portal.azure.com/](https://portal.azure.com/)).
        2. Click on the "Security Center" icon in the left-hand menu.
        3. Click on the "Security policy" link in the Security Center dashboard.
        4. In the "Policy" blade, click on the "Edit" button.
        5. Scroll down to the "Security contact phone number" policy setting and click on it.
        6. Enable the policy by clicking on the "On" button.
        7. Enter a valid phone number in the "Security contact phone number" field.
        8. Click on the "Save" button to save the policy changes.

        Once you have completed these steps, the "No Security Contact Phone Set" misconfiguration will be remediated in Azure.

        #
      </Accordion>

      <Accordion title="Using CLI">
        To remediate the misconfiguration "No Security Contact Phone Set" for AZURE using AZURE CLI, follow these steps:

        1. Open the Azure CLI on your local machine or using the Azure Cloud Shell.

        2. Run the following command to check the current security contact phone number configuration:

           ```
           az security contact show
           ```

        3. If the output shows that no phone number is set, run the following command to set the security contact phone number:

           ```
           az security contact create --email <email-address> --phone <phone-number> --name <contact-name> --alert-notifications true
           ```

           Replace the `<email-address>`, `<phone-number>`, and `<contact-name>` placeholders with the appropriate values.

        4. After running the command, verify that the security contact phone number has been set by running the following command:

           ```
           az security contact show
           ```

           The output should show the updated security contact information.

        By following these steps, you have successfully remediated the "No Security Contact Phone Set" misconfiguration for AZURE using AZURE CLI.
      </Accordion>

      <Accordion title="Using Python">
        To remediate the misconfiguration of "No Security Contact Phone Set" in Azure using Python, you can use the Azure SDK for Python. Here are the steps to follow:

        1. Install the Azure SDK for Python using the following command:

           ```
           pip install azure-mgmt-monitor
           ```

        2. Import the necessary modules and authenticate with Azure using your credentials:

           ```python theme={null}
           from azure.common.credentials import UserPassCredentials
           from azure.mgmt.monitor import MonitorManagementClient

           # Replace the values with your actual credentials
           credentials = UserPassCredentials(
               'username@your-azure-account.com',
               'your-password'
           )

           subscription_id = 'your-subscription-id'

           # Create the MonitorManagementClient object
           monitor_client = MonitorManagementClient(
               credentials,
               subscription_id
           )
           ```

        3. Get the list of all the action groups in your Azure account:

           ```python theme={null}
           action_groups = monitor_client.action_groups.list()
           ```

        4. Check if any of the action groups have a phone number set:

           ```python theme={null}
           for action_group in action_groups:
               if action_group.sms_receivers:
                   print(f"Phone number set for {action_group.name}")
               else:
                   print(f"No phone number set for {action_group.name}")
           ```

        5. If you find an action group with no phone number set, update it with a valid phone number:

           ```python theme={null}
           for action_group in action_groups:
               if not action_group.sms_receivers:
                   action_group.sms_receivers = ["+1XXXYYYZZZZ"]  # Replace with your phone number
                   monitor_client.action_groups.create_or_update(
                       action_group.resource_group_name,
                       action_group.name,
                       action_group
                   )
                   print(f"Phone number set for {action_group.name}")
           ```

        By following these steps, you can remediate the misconfiguration of "No Security Contact Phone Set" in Azure using Python.
      </Accordion>

      <Accordion title="Using Terraform">
        ```hcl theme={null}
        resource "azurerm_security_center_contact" "security_contact" {
          # Replace with a stable, descriptive name for this contact
          name = "DEFAULT"

          # REQUIRED: set at least one security contact email
          email = "SECURITY_CONTACT_EMAIL@example.com"  # <-- replace with a real email

          # REQUIRED: set at least one security contact phone (E.164 format recommended)
          phone = "+1XXXYYYZZZZ"                        # <-- replace with a real phone number

          # Optional but typically recommended settings
          alert_notifications = true
          alerts_to_admins    = "On"
        }
        ```

        Changing the `phone` value on an existing `azurerm_security_center_contact` updates the resource in place; it does not force replacement.

        Verification: `terraform plan` should show an in-place update (`~`) to the existing `azurerm_security_center_contact` with the `phone` argument being added or changed.
      </Accordion>
    </AccordionGroup>
  </Tab>
</Tabs>
