Skip to main content

More Info:

Use Azure Active Directory Authentication for authentication with SQL Database to manage credentials in a single place.

Risk Level

Medium

Address

Security

Compliance Standards

  • APRA CPS 234 (Australia)
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS AZURE
  • CIS Critical Security Controls v8
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • Cloudanix Best Practice
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • Essential 8
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIS2 Directive
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

To remediate the misconfiguration of not having Azure Active Directory (AD) Admin configured, you can follow these steps:
  1. Log in to the Azure portal (https://portal.azure.com) using your credentials.
  2. In the left-hand menu, click on “Azure Active Directory”.
  3. Click on “Properties” under the “Manage” section in the left-hand menu.
  4. Scroll down to the “Azure AD admin” section.
  5. Click on “Set Azure AD admin” button.
  6. In the “Set administrator” pane, select the user or group that you want to designate as the Azure AD admin.
  7. Click on the “Select” button.
  8. Click on the “Save” button to save the changes.
Once you have completed the above steps, the Azure AD admin will be configured, and you will have successfully remediated the misconfiguration.

To remediate the misconfiguration “Ensure That Azure Active Directory Admin Is Configured” for AZURE using AZURE CLI, follow the below steps:
  1. Open the AZURE CLI and login to your Azure account using the command:
  2. Once you are logged in, set your subscription using the command:
    Replace <subscription-id> with the ID of your Azure subscription.
  3. Next, use the following command to set the Azure Active Directory (Azure AD) admin for your subscription:
    Replace <subscription-id> with the ID of your Azure subscription.
  4. This command will create a new Azure AD application and assign it the Owner role for your subscription. It will output the following details:
    • appId: The Application ID of the newly created Azure AD application.
    • displayName: The display name of the Azure AD application.
    • password: The password for the Azure AD application. This is the only time the password will be shown, so make sure to save it in a secure location.
    • tenant: The ID of the Azure AD tenant associated with the subscription.
  5. Finally, use the following command to assign the newly created Azure AD application as the subscription admin:
    Replace <appId> with the Application ID of the newly created Azure AD application, and <subscription-id> with the ID of your Azure subscription.
  6. After running the above command, the Azure AD admin will be configured for your subscription. You can verify this by running the following command:
    This command will display the details of your Azure subscription, including the Azure AD admin.
To remediate the misconfiguration “Ensure that Azure Active Directory Admin is configured” in Azure using Python, you can follow the below steps:Step 1: Install the Azure SDK for Python using the pip command:
Step 2: Import the required modules:
Step 3: Authenticate and create a client object:
Step 4: Get the list of all SQL servers in the subscription:
Step 5: For each SQL server, check if the Azure Active Directory Admin is configured:
Note: You will need to replace the placeholders your_subscription_id, your_username, your_password, your_storage_account, your_storage_account_access_key, and your_storage_account_subscription_id with your own values.The above code will enable auditing for the SQL server and ensure that the Azure Active Directory Admin is configured.
This change does not replace the SQL server; it adds/updates the Azure AD administrator configuration in place.Verification with terraform plan should show creation (or update) of azurerm_mssql_active_directory_administrator.SQL_SERVER_AAD_ADMIN with the specified tenant_id, object_id, login, and principal_type, and no destroy of the existing azurerm_mssql_server.

Additional Reading: