Skip to content

How to grant EnrollmentReader role to the CloudMonitor Service Principal for EA Billing Accounts

First navigate to the REST API page - https://learn.microsoft.com/en-us/rest/api/billing/2019-10-01-preview/role-assignments/put?tabs=HTTP#code-try-0 • Sign in with an Admin Account. • Select the AD Tenant that contains the CloudMonitor Service Principal.

Step 1 screenshot

You will see that the right pane has changed into a simple API platform. In the Parameters section we need to provide values for the following fields:

  1. billingAccoutName
  2. billingRoleAssignmentName

Step 2 screenshot

The billingAccountName is your “Billing account ID”. You can find this in the Azure portal on the “Cost Management + Billing” Overview. In our example below it is 1111111.

Step 3 screenshot

Paste the “Billing account ID” into the billingAccountName input field.

Step 4 screenshot

For the second input, we need to provide a random, unique GUID. We can generate one using the online GUID/UUID Generator website - https://guidgenerator.com.

Step 5 screenshot

Paste the GUID in the billingRoleAssignmentName input field.

Step 6 screenshot

The Parameters section is now done. We will now move onto providing a JSON object in the Body section.

Step 7 screenshot

Replace <your-billing-accountId> with the same billingAccountId used in the “billingAccountName” parameter. In our example, it is “1111111”.

Step 8 screenshot

Replace <billing-role-definitionId> with “24f8edb6-1668-4659-b5e2-40bb5f3a7d7e”. The reason for this specific value is explained in the next step.

Step 9 screenshot

Note: “24f8edb6-1668-4659-b5e2-40bb5f3a7d7e” represents the role definition ID for the EnrollmentReader role. This role grants the Service Principal Name (SPN) read access to view your billing information.

Step 10 screenshot

Then replace <your-principal-tenantId> with your AD Tenant Id. You can locate it via:

  1. Go to Azure Ad > App Registrations > Find the CloudMonitor Service Principal/App (Tip: paste the Service Principal’s Client Id for filtering).
  2. Replace <your-principal-tenantId> with the “Directory (tenant) Id” field.
  3. Stay on this page for a future step.

Step 11 screenshot

Lastly, replace <your-principal-Id> with the CloudMonitor Service Principal Managed Application resource Object ID. You can find it by:

  1. Continuing from the last location & clicking on the Managed Application link.
  2. Replace <your-principal-Id> with the “Object ID”.

Step 12 screenshot

Your Body section should now look similar to the below:

Step 13 screenshot

Click “Run” – it should return a “200” Status Code if it made the association successfully.

Step 14 screenshot