App Registration Setup
Before connecting any Azure resource to Guardrails, you need an App Registration in Microsoft Entra ID. This App Registration provides the credentials Guardrails uses to discover and inventory resources in your environment.
Process Overview
Setting up the App Registration involves four steps:
- Create an App Registration in Microsoft Entra ID.
- (Client Secret authentication only) Create a Client Secret on the App Registration.
- Assign Microsoft Graph API Permissions to the App Registration.
- Assign Azure IAM Permissions. This may involve creating a custom Read-Only IAM role.
- Connect the Azure tenant or subscription to Guardrails.
Each step is described in the collapsible sections below. When you're done, follow the Next Steps to connect your tenant or subscription.
[!TIP] If you're using Workload Identity Federation (recommended for new deployments), the WIF setup script handles Microsoft Graph API Permissions and Reader RBAC for you. You only need Step 1 from this page. Skip the Client Secret, API Permissions, and IAM Permissions sections entirely.
Creating a Guardrails App Registration
An App Registration is required to connect any Azure resource to Guardrails. The process is the same whether you're connecting tenants or subscriptions.
-
Login to the Azure Portal.
-
Navigate to Microsoft Entra ID > App Registrations.
- Click New registration.
- Under Name, enter a name for the application. For example, Guardrails Application.
- Under Supported account types, choose which accounts can access the Guardrails application. The default Single tenant only - <your directory name> is generally the correct choice. If multiple Azure tenants need access, pick one of the multi-tenant options.
- Under Redirect URI (optional), select Web as the platform and enter the URI of your Guardrails console. Click Register.
-
Copy both the Directory (tenant) ID and the Application (client) ID from the page that appears after successful creation of the App Registration. These values are used when connecting Guardrails to the Azure resource.
Create Client Secret
[!NOTE] The Client Secret is only needed if you plan to connect using the Client Secret authentication method. If you're connecting via Workload Identity Federation, skip this step. WIF replaces the client secret entirely.
- Navigate to Microsoft Entra ID > App Registrations and select your Guardrails App Registration.
- Go to the Certificates & secrets sidebar item.
- Click on the Client Secrets tab.
- Click + New client secret. Provide a description and expiration period that matches organizational policy.
- Save the Client Secret Value for later use. The Secret ID is not used by Guardrails.
[!IMPORTANT] Copy the Client Secret value immediately. It won't be shown again after you navigate away from the page.
Microsoft Graph API Permissions
API permissions are required when importing a Tenant. Skip this section if importing only a subscription.
-
Navigate to Microsoft Entra ID > App Registrations and select your Guardrails App Registration.
-
Click API Permissions on the left side. If there are any existing permissions, remove them by clicking the three dot menu icon and selecting Remove Permission.
-
Add the following API Permissions using the + Add a permission button:
- Microsoft Graph
- Application Permissions
- AuditLog
- AuditLog.Read.All (Read all audit log data)
- Directory
- Directory.Read.All (Read directory data)
- AuditLog
- Application Permissions
AuditLog.Read.All is required for event polling on tenants and Entra ID directories. Without it, the Event Poller controls in the
azureandazure-activedirectorymods fail with permission errors. - Microsoft Graph
[!NOTE] After adding the above permissions, remember to grant admin consent by clicking Grant Admin consent for <directory name>.
Which Azure IAM Permissions to Grant
The Azure permissions granted to Guardrails depend on your organization's requirements. The table below shows the permissions recommended for various levels of Guardrails interaction with Azure resources.
| Guardrails Mode | Required Permission | Description |
|---|---|---|
| Read/Write + Permissions | Owner | Detective controls, enforcements, and manage permissions |
| Read/Write | Contributor | Detective controls and enforcements |
| Read-Only | Reader and/or Custom Role | Detective controls |
These roles apply at the tenant level for initial connection. The same role requirements apply at the subscription level when you upgrade individual subscriptions to All Resources mode. See Configure Tenant Member Subscription Access for details.
Turbot recommends that organizations craft a custom role to meet their individual least privilege requirements. The Read-Only custom role described below should be used as a baseline.
Custom ReadOnly IAM Role
The default Reader RBAC provides broad read-only access to all Azure resource types. However, there are a few additional permissions that Guardrails needs to inventory all resource types. The custom role described below grants read-only access plus the extra permissions.
Create the Role
The Read-Only custom role can be created in the embedded bash shell in the Azure Portal.
- Click the Shell icon in the top right, next to the search bar.
- Select the Bash option. If an option is not presented, ensure that bash is selected in the dropdown menu in the top left of the shell.
- Create and open a JSON file using the text editor of choice. For example, enter
vim guardrails-readonly.jsoninto the shell terminal then hit enter. - Paste the JSON below into the new text file. Be sure to add the Tenant ID to this text in the
assignableScopesattribute.
{
"properties": {
"roleName": "Guardrails ReadOnly Role",
"description": "Used by Guardrails for ReadOnly Access to Azure resources",
"assignableScopes": [
"/providers/Microsoft.Management/managementGroups/<<Tenant ID>>"
],
"permissions": [
{
"actions": [
"*/read",
"Microsoft.Management/getEntities/action",
"Microsoft.Storage/storageAccounts/listkeys/action",
"Microsoft.KeyVault/vaults/secrets/read",
"Microsoft.KeyVault/vaults/read"
],
"notActions": [],
"dataActions": [],
"notDataActions": []
}
]
}
}
[!NOTE] For those who do not wish to grant
storageAccounts/listkeys, set the Azure > Storage > Queue > CMDB policy toSkipto avoid discovery errors. Queue discovery and management is not possible withoutlistkeyspermissions.
Review the documentation for Azure custom roles for the various ways a custom role can be created.
- To create the role, run this command in the shell:
az role definition create --role-definition guardrails-readonly.json
Assign Azure IAM Permissions
The user provisioning Guardrails IAM permissions should have the Access management for Azure resources option set to Yes. If there is any question whether a global administrator has the correct access, refer to Microsoft's guide on elevating access for a Global Administrator. If permissions had to be assigned, be sure to log out and log back in to refresh the permission set.
- Once access has been verified, navigate to the target Tenant, Management Group, or Subscription in the Azure Portal.
- Select the Access control (IAM) tab on the left side.
- Towards the top left, click + Add and select Add Role Assignment. This opens a new overlay on the right side.
- In the Role dropdown, type the title of the role created above. Note that this search is case-sensitive.
- Leave the Assign access to field as default, then search for the Guardrails App Registration.
- Click Save to confirm the role assignment.
[!NOTE] All child resources inherit any access granted on parent resources. For example, granting
Readerto the Azure tenant grants the same permissions to all management groups and subscriptions.
Next Steps
With the App Registration, API permissions, and Azure IAM permissions configured, you're ready to connect your Azure resources to Guardrails:
| Guide | Description |
|---|---|
| Connect an Azure Tenant | Recommended. Connect your entire tenant with automatic subscription and management group discovery. |
| Connect an Azure Subscription | Connect a single standalone subscription. |