Grant Root Management Group Permissions
This guide is to be performed once per Azure Tenant.
The guide assumes that you have already created an Azure App Registration in your Azure Tenant.
If you haven't created an App Registration yet, please follow the Create a New Azure App Registration guide.
This guide assumes that you have Azure Management Groups enabled in your Azure Tenant.
If you do not have Azure Management Groups enabled, you can follow the link to Learn about Azure Management Groups.
This guide will walk you through the process of assigning the App Registration permissions at the root management group level.
Assigning the permissions at the root management group level will cascade the permissions to all the Azure Subscriptions under the root management group, giving Chronom the ability to automatically discover and scan all the Azure Subscriptions under the root management group.
Prerequisites
In order to grant the App Registration permissions at the root management group level, you need to have:
- At least one Active Azure Subscription.
- An Azure App Registration with a client secret. Create a New Azure App Registration
- Azure Management Groups enabled in your Azure Tenant.
- The ability to create a custom role at the root management group level.
- The ability to assign the custom role to the App Registration.
(In order to gain the ability to create custom roles, you need to elevate your Entra ID Permissions to theUser Access Administrator
role by following this guide)
Instructions
Create a Custom Role (Recommended)
If you want to grant Chronom the ability to perform a more in-depth scan of your Azure Subscriptions, you can create a custom role with the necessary permissions.
To create a custom role, follow these steps:
- Azure Portal
- Azure CLI (bash)
- Azure CLI (PowerShell)
-
Download the
Chronom Custom Role JSON
file by clicking here and saving it to your computer. -
Open the Azure Portal
Management Groups
. -
Select the
Tenant Root Group
from the list of management groups.
(Alternatively, you can select any other management group that you want to assign the custom role to, but this guide assumes that you are assigning the custom role at the root management group level.) -
Click on the
Access control (IAM)
tab. -
Click on the
+ Add
button and selectAdd custom role
. -
Fill in the following details:
- Baseline Permissions:
Start from JSON
- Upload the JSON file you downloaded in step 1.
- Click on the
Next
button.
- Baseline Permissions:
-
Review the permissions and click on the
Next
button.
If the permissions are too broad, you can remove the problematic permissions by clicking on the 🗑️ icon.
(Any of the permissions can be removed except for the*/read
permissions.)
In addition, you can exclude specific actions by clicking on the+ Exclude permissions
button. -
Under
Assignable scopes
clickAdd assignable scopes
, make sure the type is set toManagement Group
, and select theTenant Root Group
.
Click on theSelect
button then clickNext
. -
Review the role JSON and click on the
Review + create
button. If you prefer, you can modify the role permissions by clicking on theEdit
button.
(any of the permissions can be removed except for the*/read
permissions.) -
Review the role details and click on the
Create
button once you are ready.
All steps bellow should be executed in the same bash session.
It is recommended to copy and paste the commands one by one to avoid any mistakes.
The steps bellow assume you have Azure CLI installed and configured with the necessary permissions.
If you haven't installed Azure CLI yet, you can follow the instructions here.
-
If not already installed, install the
curl
andsed
packages according to your specific OS. -
Authenticate Azure CLI with the Tenant where your subscriptions are by running the following command:
az login
-
Download the
Chronom Custom Role JSON
file by running the following command:tenantId=$(az account show --query tenantId -o tsv)
rootGroupId=$(az account management-group show --name "$tenantId" --query id --output tsv)
jsonFilePath="/tmp/chronom-custom-role-cli.json"
curl -o $jsonFilePath "https://docs.chronom.ai/assets/files/chronom-custom-role-cli.json"
sed -i "s|/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|${rootGroupId}|g" "$jsonFilePath" -
Create the custom role by running the following command:
az role definition create --role-definition @$jsonFilePath
The complete bash script
# Login to Azure CLI
az login
# Set the Management Group ID Variables
tenantId=$(az account show --query tenantId -o tsv)
rootGroupId=$(az account management-group show --name "$tenantId" --query id --output tsv)
# Download the Chronom Custom Role JSON file
jsonFilePath="/tmp/chronom-custom-role-cli.json"
curl -o $jsonFilePath "https://docs.chronom.ai/assets/files/chronom-custom-role-cli.json"
sed -i "s|/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx|${rootGroupId}|g" "$jsonFilePath"
# Create the custom role
az role definition create --role-definition @$jsonFilePath
All steps bellow should be executed in the same PowerShell session.
It is recommended to copy and paste the commands one by one to avoid any mistakes.
The steps bellow assume you have Azure CLI installed and configured with the necessary permissions.
If you haven't installed Azure CLI yet, you can follow the instructions here.
-
Authenticate Azure CLI with the Tenant where your subscriptions are by running the following command:
az login
-
Download the
Chronom Custom Role JSON
file by running the following command:$tenantId = az account show --query tenantId -o tsv
$rootGroupId = az account management-group show --name "$tenantId" --query id --output tsv
$jsonFilePath="$env:USERPROFILE\Downloads\chronom-custom-role-cli.json"
Invoke-WebRequest -Uri "https://docs.chronom.ai/assets/files/chronom-custom-role-cli.json" -OutFile $jsonFilePath
(Get-Content $jsonFilePath) -replace "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", $rootGroupId | Set-Content $jsonFilePath -
Create the custom role by running the following command:
az role definition create --role-definition @$jsonFilePath
The complete PowerShell script
# Login to Azure CLI
az login
# Set the Management Group ID Variables
$tenantId = az account show --query tenantId -o tsv
$rootGroupId = az account management-group show --name "$tenantId" --query id --output tsv
# Download the Chronom Custom Role JSON file
$jsonFilePath="$env:USERPROFILE\Downloads\chronom-custom-role-cli.json"
Invoke-WebRequest -Uri "https://docs.chronom.ai/assets/files/chronom-custom-role-cli.json" -OutFile $jsonFilePath
(Get-Content $jsonFilePath) -replace "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", $rootGroupId | Set-Content $jsonFilePath
# Create the custom role
az role definition create --role-definition @$jsonFilePath
Grant Permissions to the App Registration
To grant permissions to the App Registration, Follow these steps:
- Azure Portal
- Azure CLI (bash)
- Azure CLI (PowerShell)
-
Open the Azure Portal
Management Groups
. -
Select the
Tenant Root Group
from the list of management groups.
(Alternatively, you can select any other management group that you want to assign the custom role to, but this guide assumes that you are assigning the custom role at the root management group level.) -
Click on the
Access control (IAM)
tab. -
Click on the
+ Add
button and selectAdd role assignment
. -
Search for the Role that will be assigned to the App Registration.
If you created a custom role in the previous stage, search for the role name you created (Most likelyChronom Reader
), otherwise, search for theReader
role.
Select the role and click on theNext
button. -
Click on the
+ Select members
and search forChronom Read-Only App Registration
(or the name you gave to the App Registration).
Select the App Registration and click on theSelect
button then clickNext
. -
Click on the
Review + assign
button. -
Once the role assignment is created, you can go back to Chronom and click on the
Save
button to complete the process.
All steps bellow should be executed in the same bash session.
It is recommended to copy and paste the commands one by one to avoid any mistakes.
The steps bellow assume you have Azure CLI installed and configured with the necessary permissions.
If you haven't installed Azure CLI yet, you can follow the instructions here.
-
Authenticate Azure CLI with the Tenant where your subscriptions are by running the following command:
az login
-
Get the App Registration's SP ID by running the following commands:
appName="Chronom Read-Only App Registration"
spId=$(az ad sp list --display-name "$appName" --query "[0].id" -o tsv) -
Confirm the App Registration's SP ID by running the following command: (Make sure the output contains the
appDisplayName
asChronom Read-Only App Registration
and thereplyUrls
ashttps://app.chronom.ai
)echo $spId
az ad sp show --id $spId -
Assign the role to the App Registration by running the following command:
⚠️ Replace<role-name>
with the name of the role you created in the previous step. (Most likelyChronom Reader
) (If you opted to use theReader
role, replace<role-name>
withReader
)roleName="<role-name>" # Replace with the role name you created / Reader
tenantId=$(az account show --query tenantId -o tsv)
rootGroupId=$(az account management-group show --name "$tenantId" --query id --output tsv)
az role assignment create --role "$roleName" --assignee "$spId" --scope "$rootGroupId"
The complete bash script
# Login to Azure CLI
az login
# Set the variables
appName="Chronom Read-Only App Registration"
roleName="Chronom Reader"
# Get the App Registration's SP ID
spId=$(az ad sp list --display-name "$appName" --query "[0].id" -o tsv)
# Confirm the App Registration's SP ID
echo $spId
az ad sp show --id $spId
# Retrieve the Tenant Root Group ID
tenantId=$(az account show --query tenantId -o tsv)
rootGroupId=$(az account management-group show --name "$tenantId" --query id --output tsv)
# Assign the role to the App Registration
az role assignment create --role "$roleName" --assignee "$spId" --scope "$rootGroupId"
All steps bellow should be executed in the same PowerShell session.
It is recommended to copy and paste the commands one by one to avoid any mistakes.
The steps bellow assume you have Azure CLI installed and configured with the necessary permissions.
If you haven't installed Azure CLI yet, you can follow the instructions here.
-
Authenticate Azure CLI with the Tenant where your subscriptions are by running the following command:
az login
-
Get the App Registration's SP ID by running the following commands:
$appName="Chronom Read-Only App Registration"
$spId=(az ad sp list --display-name "$appName" --query "[0].id" -o tsv) -
Confirm the App Registration's SP ID by running the following command: (Make sure the output contains the
appDisplayName
asChronom Read-Only App Registration
and thereplyUrls
ashttps://app.chronom.ai
)$spId
az ad sp show --id $spId -
Assign the role to the App Registration by running the following command: ⚠️ Replace
<role-name>
with the name of the role you created in the previous step. (Most likelyChronom Reader
) (If you opted to use theReader
role, replace<role-name>
withReader
)$roleName="<role-name>" # Replace with the role name you created / Reader
$tenantId=(az account show --query tenantId -o tsv)
$rootGroupId=(az account management-group show --name "$tenantId" --query id --output tsv)
az role assignment create --role "$roleName" --assignee "$spId" --scope "$rootGroupId"
The complete PowerShell script
# Login to Azure CLI
az login
# Set the variables
$appName="Chronom Read-Only App Registration"
$roleName="Chronom Reader"
# Get the App Registration's SP ID
$spId=(az ad sp list --display-name "$appName" --query "[0].id" -o tsv)
# Confirm the App Registration's SP ID
$spId
az ad sp show --id $spId
# Retrieve the Tenant Root Group ID
$tenantId=(az account show --query tenantId -o tsv)
$rootGroupId=(az account management-group show --name "$tenantId" --query id --output tsv)
# Assign the role to the App Registration
az role assignment create --role "$roleName" --assignee "$spId" --scope "$rootGroupId"