Skip to content

Azure Authentication

DRACO authenticates to Azure with a Service Principal Application (tenant ID, client ID and client secret).

Required Permissions

DRACO for Azure requires two types of permission scopes:

Microsoft Entra ID Permissions

These permissions allow DRACO to retrieve metadata from the assumed identity and perform specific Entra checks. While not mandatory for execution, they enhance functionality.

Assigning Required API Permissions

Assign the following Microsoft Graph permissions:

  • AuditLog.Read.All
  • Directory.Read.All
  • Policy.Read.All

Note

Replace Directory.Read.All with Domain.Read.All for more restrictive permissions. Note that Entra checks related to DirectoryRoles and GetUsers will not run with this permission.

  1. Go to your App Registration > "API permissions"

API Permission Page

  1. Click "+ Add a permission" > "Microsoft Graph" > "Application permissions"

Add API Permission Microsoft Graph Detail

  1. Search and select:

  2. AuditLog.Read.All

  3. Directory.Read.All
  4. Policy.Read.All

Permission Screenshots

  1. Click "Add permissions", then grant admin consent

Grant Admin Consent Granted Admin Consent

  1. To grant permissions to a Service Principal, execute the following command in a terminal:
az ad app permission add --id {appId} --api 00000003-0000-0000-c000-000000000000 --api-permissions 7ab1d382-f21e-4acd-a863-ba3e13f7da61=Role 246dd0d5-5bd0-4def-940b-0421030a5b68=Role b0afded3-3588-46d8-8b3d-9842eff778da=Role

Subscription Scope Permissions

These permissions are required to perform security checks against Azure resources. The following RBAC roles must be assigned per subscription to the entity used by DRACO:

  • Reader – Grants read-only access to Azure resources.
  • DracoRole – A custom role with minimal permissions needed for some specific checks, defined below.

Assigning "Reader" Role at the Subscription Level

Each DRACO provider scans the one subscription whose ID you enter. Assign the Reader role on every subscription you connect (or once on a management group above them).

  1. To grant DRACO access to scan a specific Azure subscription, follow these steps in Azure Portal: Navigate to the subscription you want to audit with DRACO.

  2. In the left menu, select "Access control (IAM)".

  3. Click "+ Add" and select "Add role assignment".

  4. In the search bar, enter Reader, select it and click "Next".

  5. In the "Members" tab, click "+ Select members", then add the accounts to assign this role.

  6. Click "Review + assign" to finalize and apply the role assignment.

Adding the Reader Role to a Subscription

  1. Open a terminal and execute the following command to assign the Reader role to the identity that is going to be assumed by DRACO:
az role assignment create --role "Reader" --assignee <user, group, or service principal> --scope /subscriptions/<subscription-id>

Assigning "DracoRole" Permissions at the Subscription Level

Some read-only permissions required for specific security checks are not included in the built-in Reader role. To support these checks, DRACO uses a custom role with the definition below. Once created, this role can be assigned following the same process as the Reader role.

The checks requiring this DracoRole can be found in this section.

  1. Save the following definition as draco-azure-custom-role.json:
{
  "properties": {
    "roleName": "DracoRole",
    "description": "Role used for checks that require read-only access to Azure resources and are not covered by the Reader role.",
    "assignableScopes": [
      "/subscriptions/<subscription-id>"
    ],
    "permissions": [
      {
        "actions": [
          "Microsoft.Web/sites/host/listkeys/action",
          "Microsoft.Web/sites/config/list/Action"
        ],
        "notActions": [],
        "dataActions": [],
        "notDataActions": []
      }
    ]
  }
}
  1. Replace <subscription-id> in assignableScopes with your Subscription ID

  2. Go to your Azure Subscription > "Access control (IAM)"

IAM Page

  1. Click "+ Add" > "Add custom role", choose "Start from JSON" and upload the modified file

Add custom role via JSON

  1. Click "Review + Create" to finish

Select review and create

  1. Return to "Access control (IAM)" > "+ Add" > "Add role assignment"

  2. Assign the Reader role to the Application created in the previous step

  3. Then repeat the same process assigning the custom DracoRole

Role Assignment

Note

The assignableScopes field in the JSON custom role file must be updated to reflect the correct subscription or management group. Use one of the following formats: /subscriptions/<subscription-id> or /providers/Microsoft.Management/managementGroups/<management-group-id>.

  1. To create a new custom role, open a terminal and execute the following command:
az role definition create --role-definition '{
                    "Name": "DracoRole",
                    "IsCustom": true,
                    "Description": "Role used for checks that require read-only access to Azure resources and are not covered by the Reader role.",
                    "AssignableScopes": [
                    "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" // USE YOUR SUBSCRIPTION ID
                    ],
                    "Actions": [
                    "Microsoft.Web/sites/host/listkeys/action",
                    "Microsoft.Web/sites/config/list/Action"
                    ]
                }'
  1. If the command is executed successfully, the output is going to be similar to the following:
{
    "assignableScopes": [
        "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
    ],
    "createdBy": null,
    "createdOn": "YYYY-MM-DDTHH:MM:SS.SSSSSS+00:00",
    "description": "Role used for checks that require read-only access to Azure resources and are not covered by the Reader role.",
    "id": "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/providers/Microsoft.Authorization/roleDefinitions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
    "name": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
    "permissions": [
        {
            "actions": [
                "Microsoft.Web/sites/host/listkeys/action",
                "Microsoft.Web/sites/config/list/Action"
            ],
            "condition": null,
            "conditionVersion": null,
            "dataActions": [],
            "notActions": [],
            "notDataActions": []
        }
    ],
    "roleName": "DracoRole",
    "roleType": "CustomRole",
    "type": "Microsoft.Authorization/roleDefinitions",
    "updatedBy": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
    "updatedOn": "YYYY-MM-DDTHH:MM:SS.SSSSSS+00:00"
}

Warning

Some permissions in DracoRole involve write access. If a ReadOnly lock is attached to certain resources, you may encounter errors, and findings for those checks will not be available.

Checks Requiring DracoRole

The following security checks require the DracoRole permissions for execution. Ensure the role is assigned to the identity assumed by DRACO before running these checks:

  • app_function_access_keys_configured
  • app_function_application_insights_enabled
  • app_function_ftps_deployment_disabled
  • app_function_latest_runtime_version

This is the method DRACO uses.

Creating the Service Principal

The service principal authenticates against Azure and reads the metadata the checks need. Create it in the Azure Portal or with the Azure CLI.

  1. Open Microsoft Entra ID in the Azure Portal.
  2. Go to Manage > App registrations.

App registrations

  1. Click + New registration, complete the form and click Register.

New registration

  1. Go to Certificates & secrets > + New client secret, fill in the fields, click Add and copy the generated value.

New client secret

az ad sp create-for-rbac --name "DracoScanner"

The output holds appId (client ID), password (client secret) and tenant (tenant ID).

Value Description
Client ID Application ID
Client Secret Secret to connect to the app
Tenant ID Microsoft Entra tenant ID

Then assign the required permissions.