Monitoring and instrumenting Microsoft® Azure with Instana agent
After you install the Instana host agent, the Microsoft® Azure sensor is automatically installed. You can view metrics that are related to Microsoft® Azure in the Instana UI after you configure Microsoft® Azure sensor as outlined in the configuration section.
Monitored services
The Instana host agent monitors Azure-managed services by collecting data from Azure APIs. Instana supports monitoring for the following Azure services:
Instrumented services
You can instrument the following services:
Supported information
Supported operating systems
The supported operating systems of the Microsoft® Azure sensor are consistent with host agents requirements. For more information, see the supported operating systems for each Instana host agent.
Sensor versions and monitoring capabilities
The Azure sensor version determines the subscription monitoring capabilities:
| Sensor version | Subscription support | Description |
|---|---|---|
| 1.2.x and earlier | Single subscription | Monitors resources within a single Azure subscription in a single tenant |
| 1.3.x and later | Multiple subscriptions | Monitors resources across multiple Azure subscriptions in a single tenant |
Installing the Instana agent
To monitor an Azure virtual machine or a Kubernetes cluster that runs on Azure Kubernetes Service, see Installing the Instana host agents.
AGENT_MAX_MEM to a value greater than the default value 544 MiB.
For example, to allocate 1 GB of memory to the agent, set AGENT_MAX_MEM=1024M.
Install the Instana host agent on a host inside or outside your Azure environment. Instana supports monitoring one or more Azure subscriptions within a single tenant. A single Instana agent supports both single-subscription and multi-subscription monitoring for Azure remote services. For single-subscription monitoring, follow the single-subscription monitoring configuration. For monitoring multiple Azure subscriptions, follow the multi-subscription monitoring configuration.
Installing an Instana agent outside your Azure environment
If you install the Instana agent outside your Azure environment, the agent uses the Azure public cloud endpoint by default.
To specify the Azure cloud endpoint that you want to use, modify the /opt/instana/agent/etc/instana/configuration.yaml agent configuration file as follows:
com.instana.plugin.azure:
cloud: 'AzurePublicCloud'
Azure cloud endpoints
Depending on the Azure cloud endpoint you want to use, you can select from these cloud configuration values: AzurePublicCloud, AzureChinaCloud, AzureUSGovernmentCloud, and AzureGermanCloud. For more information on Azure cloud endpoints, see Azure cloud endpoints.
Make sure that you have access to the following network endpoints for your selected Azure cloud environment:
| Azure cloud endpoint | Active Directory endpoint | Management endpoint |
|---|---|---|
AzurePublic: Microsoft Azure public cloud |
https://login.microsoftonline.com |
https://management.azure.com/ |
AzureChina: Microsoft Chinese national cloud |
https://login.chinacloudapi.cn/ |
https://management.chinacloudapi.cn/ |
AzureGermany: Microsoft German national cloud |
https://login.microsoftonline.de/ |
https://management.microsoftazure.de/ |
AzureUsGovernment: US Government cloud |
https://login.microsoftonline.us/ |
https://management.usgovcloudapi.net/ |
To enable external monitoring of Azure services, configure your firewall to allow access to the above REST API endpoints based on your Azure cloud environment. Also, make sure that firewall access to the Log Analytics endpoint at https://api.loganalytics.io, which is required mainly for Databricks, regardless of Azure cloud endpoints.
Instana's Azure monitoring
Instana discover Azure resources by using two primary methods:
- VM Metadata Service: The Instana agent queries the Azure Instance Metadata Service (IMDS) at
http://169.254.169.254/metadata/instanceto collect the basic information about the VM instance where the agent is installed. - Azure Resource Manager (ARM) API: Instana uses ARM API to discover what Azure resources exist in a subscription.
You can provide the client ID, client secret, and the tenant ID through the configuration files. Instana automatically retrieves and refreshes access tokens and uses them to access the required Azure APIs based on the permissions granted.
Authorization URL : {activeDirectoryEndpoint} + {TenantId} + /oauth2/token
The sensor that is registered for each discovered resource, periodically collects metrics and metadata for its resource by using Azure Monitor APIs.
Azure API
Azure Resource Manager(ARM) API: Instana uses ARM API to discover the Azure resources within a subscription and collects configuration details such as names, types, locations, and tags. Instana also uses these details to understand how resources connect to each other.
ARM API endpoints typically use this pattern: https://{managementendpoint}/subscriptions/{subscriptionId}/...
https://management.azure.com/subscriptions/{subscriptionId}/...https://management.usgovcloudapi.net/subscriptions/{subscriptionId}/...
Azure Monitor API: Instana uses the same Azure Monitor API, which shares ARM management endpoint, to collect monitoring data such as metrics, logs, and health information about Azure resources.
Azure Monitor API endpoints typically use this pattern: https://{managementendpoint}/subscriptions/{subscriptionId}/providers/Microsoft.Insights/...
https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Insights/...https://management.usgovcloudapi.net/subscriptions/{subscriptionId}/providers/Microsoft.Insights/...
Service principal
1. Creating service principal
To enable Azure monitoring, configure the host agent with a service principal that has at least reader permissions. You can create a service principal by using the Azure portal, Azure CLI, or Azure PowerShell.
Create a service principal in the Azure portal
The following steps describe how to create a service principal account with read access to your resources in the Azure portal.
Create a service principal by registering an application in the Azure portal:
- Open the Azure management Portal and select Microsoft Entra ID.
- Copy the Tenant ID value. You need this value to configure the agent to connect to your Azure account.
- Select App registrations in the navigation pane.
- Create a new application by selecting New registration at the top of the App registrations tab.
- Enter the name of your application, leave all other settings with their default values, and select Register.
- Copy the Application (client) ID value. You need this value to configure the Service principal ID that the agent uses to connect to the Azure account.
- Open the newly created app and select Certificates & secrets > New client secret from the navigation menu to create a new security key.
- Copy the Value of the new Key and save it. You need this value to configure the Service Principal Secret that the agent uses to connect to your Azure account.
Create a service principal by using Azure CLI
You can use the Azure Command-Line Interface (CLI), a fast and simple method to create a service principal and assign a role in a single command.
- Install the Azure CLI.
- Run the
az logincommand in your terminal to sign in to your Azure account, and then follow the on-screen instructions. - Open your terminal or Azure Cloud Shell.
- Run the following command to find your subscription ID:
az account show --query id --output tsv - Run the following command to create a service principal. Replace
service-principal-name,role, andsubscription-IDwith your specific values.az ad sp create-for-rbac --name "<service-principal-name>" --role "<role>" --scopes "/subscriptions/<subscription-id>"--name: A unique name for your service principal.--role: The RBAC role to assign, such as contributor, reader, or owner.--scopes: The Azure resource scope to apply the role to, such as your subscription, resource group, or a specific resource.
- The output from the preceding command provides the service principal's credentials. Copy and securely store the
appId(Client ID), password (Client secret), and tenant (Tenant ID) from the JSON output. The password is shown only once and cannot be retrieved later. - Run the following command to verify the new role assignment, Replace the
appIdwith your Client ID:az role assignment list --assignee "<appId>"
Creating a service principal by using Azure PowerShell
To create a service principal by using Azure PowerShell and grant the required access, follow the steps in theAzure PowerShell documentation.
2. Grant reader permission to your service principal
By using the Azure portal:
- In the Azure portal, select All services > General > Subscriptions.
- On the subscriptions page, select your subscription, and then select Access control (IAM).
- Select Add role assignment, and choose Reader. Click Next.
- In the Members section, enter the following details:
- For Assign access to, select
user,group, orservice principal. - For Members, click Select members, and then select your service principal from the list on the left.
- For Assign access to, select
- Click Next, and then select Review + assign.
By using Azure CLI:
Reader in the same command when you create the service principal, the CLI automatically grants read permission to the service principal:
az ad sp create-for-rbac --name "<service-principal-name>" --role "Reader" --scopes /subscriptions/{subscription-id}
To verify reader role for a service principal by using Python script (optional), see the Python script.
3. Enable the Azure sensor in the agent
configuration.yaml file. A minimal configuration for monitoring a single subscription looks like the following example:
com.instana.plugin.azure:
enabled: true
subscription: "Your-Subscription-Id"
tenant: "Your-Tenant-Id"
principals:
- id: "Your-Service-Principal-Account-Id"
secret: "Your-Service-Principal-Secret"
Restart the host agent to apply the new configuration. After the restart, the agent can automatically discover supported remote services on the specified subscription.
Azure Resource Manager (ARM) uses a token bucket–based throttling model, allowing short request bursts (for example, 250 reads) with a sustained refill rate (25 requests per seconds). Instana’s Azure monitoring collects metrics and resource data across subscriptions, which can generate a high number of API requests, especially in large environments. To overcome this limitation, you can create multiple service principals. For instructions on how to create service principles, see Use Azure PowerShell to create a service principal with a certificate.
After you create the service principals, update the /opt/instana/agent/etc/instana/configuration.yaml file on the Instana host agent as follows:
com.instana.plugin.azure:
enabled: true
subscription: "Your-Subscription-Id"
tenant: "Your-Tenant-Id"
principals:
- id: "Your-Service-Principal-Account-Id-1"
secret: "Your-Base64-encoded-Service-Principal-Secret-1"
- id: "Your-Service-Principal-Account-Id-2"
secret: "Your-Base64-encoded-Service-Principal-Secret-2"
Configuration
Proxy configuration
To configure the Instana host agent to use a proxy, add the following settings to the agent configuration:
com.instana.plugin.azure:
proxy_host: 'example.com' # proxy host name or ip address
proxy_port: 3128 # proxy port
proxy_username: 'username' # OPTIONAL: proxy username
proxy_password: 'password' # OPTIONAL: proxy password
Define both the proxy_host and proxy_port fields to enable the agent to route traffic through a proxy server.
After you configure the proxy, restart the Instana agent for the changes to take place.
Filtering and tagging
The Instana host agent supports filtering of Azure services. The filtering of services and their instances is based on tags and resource groups.
For more information on how to apply tags to Azure resources, see Use tags to organize your Azure resources and management hierarchy.
For more information about defining resource groups in Azure, see What is Azure Resource Manager?.
Apply filtering by modifying the Instana host agent configuration file at /opt/instana/agent/etc/instana/configuration.yaml as follows:
com.instana.plugin.azure:
# Comma separated list of tags in key:value format
include_tags:
# Comma separated list of tags in key:value format
exclude_tags:
# Comma separated list of resource groups
include_resource_groups:
# Comma separated list of resource groups
exclude_resource_groups:
You can also apply filtering at the level of specific services. For more information, see the Monitored Services section for details on specific services.
Filtering API per API management service
When you have too many APIs under one API Management service, it can be challenging to collect and analyze the data effectively. To focus on important APIs, configure API filtering by defining an inclusive or exclusive regular expression as shown in the following example YAML file:
com.instana.plugin.azure.apimanagement:
monitorApiList:
- serviceName: 'robotShopApiGateway'
#inclusiveApiRegex: '^(API name 1|API name 2)$'
exclusiveApiRegex: '^(API name 1|API name 2)$'
As shown in the preceding example, you can use complex regex expressions with or and and logic. If you define both inclusiveApiRegex and exclusiveApiRegex, the host agent prioritizes exclusiveApiRegex.
To monitor a very large number of resources, you can either configure multiple subscriptions per agent or deploy multiple agents, each with a single subscription. In both cases, ensure that subscriptions are not shared across agents and remain mutually exclusive.
Configuring Azure multi-subscription monitoring (public preview)
Instana supports monitoring multiple Azure subscriptions within the same tenant by using a single host agent. This capability provides comprehensive visibility across your Azure infrastructure without requiring separate agents for each subscription.
Prerequisites
- All subscriptions must belong to the same Azure tenant.
- Each subscription requires at least one service principal with Reader role permissions.
Configuration for multiple subscriptions
To monitor multiple Azure subscriptions, configure the Instana host agent with the subscription and service principal details in the /opt/instana/agent/etc/instana/configuration.yaml file:
com.instana.plugin.azure:
enabled: true
tenant: 'Your-Tenant-Id'
subscriptions:
- id: 'Subscription-Id-1'
principals:
- id: 'Service-Principal-Client-Id-1'
secret: 'Service-Principal-Client-Secret-1'
- id: 'Service-Principal-Client-Id-2'
secret: 'Service-Principal-Client-Secret-2'
- id: 'Subscription-Id-2'
principals:
- id: 'Service-Principal-Client-Id-3'
secret: 'Service-Principal-Client-Secret-3'
- id: 'Service-Principal-Client-Id-4'
secret: 'Service-Principal-Client-Secret-4'
Each subscription can have multiple service principals configured to distribute API load.
Best practices for multi-subscription monitoring
- Service principal planning: Create at least 2-3 service principals per subscription to avoid throttling when monitoring a large number of resources.
- Resource distribution: When monitoring a large number of resources, consider distributing them across multiple subscriptions and different regions as described in the Azure Documentation.
- Required permissions: Ensure that each service principal has at least the reader role access to the subscription. Service principals without required permissions are skipped during the API client configuration.
Observations on agent sizing and resource scalability for multi-subscription monitoring
The following observations outline the validated performance limits for the Instana agent when monitoring synthetic Azure resources. These results are based on stress testing on Ubuntu 24.04 to determine the safe limit for stable operations.
Increasing machine resources and Java Heap size allows for higher entity counts. However, be aware that scaling beyond these limits might increase the frequency of HTTP 429 (Too Many Requests) errors from the Azure Resource Manager API, particularly for specific resource types, such as Storage and Load Balancers.
Validated load test Results
The following table represent the stable thresholds discovered during testing. Crossing these thresholds without a corresponding increase in Heap memory might result in java.lang.OutOfMemoryError.
| Azure VM size | Hardware specs | Agent Max Heap (INSTANA_AGENT_MAX_MEM) |
Monitored Azure resources | Service principals used per subscription |
|---|---|---|---|---|
| Standard D4ds_v6 | 4 vCPU, 16 GiB RAM | 2048 MB | 3,000 | 3 |
| Standard D8s_v6 | 8 vCPU, 32 GiB RAM | 2048 MB | 7,000 | 4 |
Scalability and API constraints
Azure API throttling (429 errors)
While the Instana agent can technically be scaled to monitor more resources by incrementing machine size and heap allocation, the Azure Portal API imposes its own limits.
- High-density monitoring increases the probability of receiving 429 error responses from Azure.
- Resource types such as Microsoft.Storage/storageAccounts, are highly susceptible to these limits.
- Frequent 429 errors can lead to gaps in metric collection and delayed discovery of new resources.
Available metrics for each resource type
You can view the list of supported metrics for the different resource types in the official Azure documentation.
Cost calculation of Azure API usage
For more information about Azure API usage cost calculations, see Azure API usage cost calculation.