Azure service principal integration setup
Sign in:
az loginChoose a scope.
Per subscription - list your subscriptions and note the IDs you want monitored:
az account list --output tablePer management group - one assignment covers every
subscription beneath it, including subscriptions moved in later. List
your management groups and take the ID from theNamecolumn:az account management-group list --output tableTo see which subscriptions a management group currently covers:
az account management-group show \ --name <management-group-id> \ --expand --recurse --output tableChoose a role. Reader is a built-in role and needs no setup. To grant less than Reader, follow using custom role details(below) first, then substitute your role name below.
Create the service principal with the role at that scope.
Subscriptions - pass as many as you want monitored:
az ad sp create-for-rbac \ --name "StatusGator" \ --role Reader \ --scopes /subscriptions/<subscription-id> /subscriptions/<another-subscription-id>Management group:
az ad sp create-for-rbac \ --name "StatusGator" \ --role Reader \ --scopes /providers/Microsoft.Management/managementGroups/<management-group-id>Copy the output - the password is shown once and cannot be retrieved later:
{ "appId": "87654321-4321-4321-4321-210987654321", "displayName": "StatusGator", "password": "abc~1DEfgh2IJklmn3OPqrst4UVwxyz5AB6c", "tenant": "12345678-1234-1234-1234-123456789012" }To widen the scope later, assign the role to the same app:
az role assignment create \ --assignee <appId> \ --role Reader \ --scope /subscriptions/<subscription-id> az role assignment create \ --assignee <appId> \ --role Reader \ --scope /providers/Microsoft.Management/managementGroups/<management-group-id>Confirm the credentials work and see every subscription they reach:
az login --service-principal --username <appId> --password <password> --tenant <tenant> az account list --output table az rest --method get --url "<https://management.azure.com/subscriptions/><subscription-id>/providers/Microsoft.ResourceHealth/events?api-version=2025-05-01"
Using a custom role instead of Reader
Reader grants read access to every resource under the scope.
StatusGator needs only to list Resource Health events and enumerate the
subscriptions it can see. A custom role narrows the grant to those two
operations.
Do this before step 4 above.
Confirm the operation names available in your tenant:
az provider operation show \ --namespace Microsoft.ResourceHealth \ --query "resourceTypes[?name=='events'].operations[].{name:name, display:displayName}" \ --output tableSave the role definition, setting
AssignableScopesto every scope you intend to assign it at:cat > statusgator-health-reader.json <<'EOF' { "Name": "StatusGator Health Reader", "Description": "Read Azure Resource Health events for StatusGator monitoring.", "IsCustom": true, "Actions": [ "Microsoft.ResourceHealth/events/read", "Microsoft.Resources/subscriptions/read" ], "NotActions": [], "DataActions": [], "NotDataActions": [], "AssignableScopes": [ "/providers/Microsoft.Management/managementGroups/<management-group-id>" ] } EOFFor a per-subscription setup, use
"/subscriptions/<subscription-id>"entries instead.Create the role:
az role definition create --role-definition @statusgator-health-reader.jsonConfirm it exists - allow a few minutes for it to propagate:
az role definition list --name "StatusGator Health Reader" --output tableUse it in place of
Readerin step 4:az ad sp create-for-rbac \ --name "StatusGator" \ --role "StatusGator Health Reader" \ --scopes /providers/Microsoft.Management/managementGroups/<management-group-id>Verify the service principal can read events before configuring StatusGator:
az login --service-principal --username <appId> --password <password> --tenant <tenant> az account list --output table az rest --method get --url "<https://management.azure.com/subscriptions/><subscription-id>/providers/Microsoft.ResourceHealth/events?api-version=2025-05-01"az account listmust return the subscriptions you expect and theaz restcall must return JSON rather than an authorization error. If either fails, assign Reader instead and open a support ticket with us.
To add a scope to an existing custom role, edit AssignableScopes in the JSON and run:
az role definition update --role-definition @statusgator-health-reader.json
In StatusGator
- Go to Integrations and add or open your Azure integration.
- Enter a Display name.
- Under Authentication, choose Service principal.
- Tenant ID -
tenantfrom the output. - Application ID -
appIdfrom the output. - Client Secret -
passwordfrom the output. - Subscription ID - leave blank to monitor every
subscription the app can read. Leave it blank if you scoped to a
management group, otherwise only the one subscription you name is
monitored. - Select Save.