Create an Azure service principal
In this milestone, you’ll create an Azure service principal that grants Grafana Cloud the necessary permissions to collect metrics from your Azure account. This service principal uses the principle of least privilege, providing the read-only access required for monitoring.
A service principal is an identity created for use with applications and services. In this case, the service principal allows Grafana Cloud to authenticate with Azure and read metrics data without requiring user credentials.
Create the service principal
To create an Azure service principal, complete the following steps:
On the Add new credential page in Grafana Cloud, click Setup instructions.
The setup instructions display the Azure CLI commands needed to create the service principal.
Open a terminal or Azure Cloud Shell.
Log in to your Azure account:
az loginList your available subscriptions to identify which subscriptions you want to monitor:
az account list --output tableCreate a service principal with the Monitoring Reader role for each subscription you want to monitor.
Replace
<subscription-id>with your Azure subscription ID:az ad sp create-for-rbac --name grafana-cloud-azure-metrics --role "Monitoring Reader" --scopes "/subscriptions/<subscription-id>"Note
If a service principal with this name already exists, this command updates it with the specified role and scopes.
Save the output of the command, which includes the credential information you need for the next milestone:
{ "appId": "12345678-1234-1234-1234-123456789012", "displayName": "grafana-cloud-azure-metrics", "password": "your-secret-password", "tenant": "87654321-4321-4321-4321-210987654321" }appIdis the Client IDpasswordis the Client secrettenantis the Tenant ID
Caution
Store the client secret securely. Azure displays this value only once during service principal creation. If you lose this value, you’ll need to create a new client secret.
The service principal is now created with read-only access to Azure Monitor metrics for the specified subscription.
In your next milestone, you’ll use this service principal to connect your Azure account to Grafana Cloud.
