Azure Monitor Metrics Batch API

Operations for batch querying Azure Monitor metrics across multiple resources

Documentation

📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/metrics
📖
Authentication
https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/rest-api-walkthrough
📖
GettingStarted
https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/rest-api-walkthrough
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/metric-definitions
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/metrics-batch
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/loganalytics/
📖
GettingStarted
https://learn.microsoft.com/en-us/azure/azure-monitor/logs/api/overview
📖
Documentation
https://learn.microsoft.com/en-us/azure/azure-monitor/logs/logs-ingestion-api-overview
📖
GettingStarted
https://learn.microsoft.com/en-us/azure/azure-monitor/logs/tutorial-logs-ingestion-api
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/alertrules
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/scheduledqueryrule-2021-08-01/scheduled-query-rules
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/action-groups
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/autoscale-settings
📖
GettingStarted
https://learn.microsoft.com/en-us/azure/azure-monitor/autoscale/autoscale-best-practices
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/application-insights/
📖
GettingStarted
https://learn.microsoft.com/en-us/azure/azure-monitor/app/opentelemetry-enable
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/diagnostic-settings
📖
GettingStarted
https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/diagnostic-settings
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/activity-logs
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/data-collection-rules
📖
GettingStarted
https://learn.microsoft.com/en-us/azure/azure-monitor/data-collection/data-collection-rule-create-edit
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/data-collection-endpoints
📖
GettingStarted
https://learn.microsoft.com/en-us/azure/azure-monitor/data-collection/data-collection-endpoint-overview
📖
Documentation
https://learn.microsoft.com/en-us/rest/api/monitor/private-link-scopes
📖
GettingStarted
https://learn.microsoft.com/en-us/azure/azure-monitor/logs/private-link-configure

Specifications

Schemas & Data

Other Resources

OpenAPI Specification

microsoft-azure-monitor-metrics-batch-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Azure Monitor Action Groups Metrics Batch API
  description: Create and manage action groups that define notification and automation actions triggered by Azure Monitor alerts, including email, SMS, webhooks, and Azure Functions.
  version: '2022-06-01'
  contact:
    name: Microsoft Azure Support
    url: https://azure.microsoft.com/en-us/support/options/
  license:
    name: Microsoft API License
    url: https://azure.microsoft.com/en-us/support/legal/
servers:
- url: https://management.azure.com
  description: Azure Resource Manager
security:
- oauth2:
  - https://management.azure.com/.default
tags:
- name: Metrics Batch
  description: Operations for batch querying Azure Monitor metrics across multiple resources
paths:
  /subscriptions/{subscriptionId}/metrics:batchGet:
    post:
      operationId: MetricsBatch_Batch
      summary: Azure Monitor Batch query metrics for multiple resources
      description: Lists the metric values for multiple resources in a single batch request. All resources must be in the same subscription, region, and resource type. Allows for efficient retrieval of metric data at scale.
      tags:
      - Metrics Batch
      parameters:
      - $ref: '#/components/parameters/SubscriptionIdParameter'
      - $ref: '#/components/parameters/ApiVersionParameter'
      - $ref: '#/components/parameters/StartTimeParameter'
      - $ref: '#/components/parameters/EndTimeParameter'
      - $ref: '#/components/parameters/IntervalParameter'
      - $ref: '#/components/parameters/MetricNamesParameter'
      - $ref: '#/components/parameters/MetricNamespaceParameter'
      - $ref: '#/components/parameters/AggregationParameter'
      - $ref: '#/components/parameters/TopParameter'
      - $ref: '#/components/parameters/OrderByParameter'
      - $ref: '#/components/parameters/FilterParameter'
      - $ref: '#/components/parameters/RollUpByParameter'
      requestBody:
        description: The batch body that contains the list of resource IDs to query metrics for.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MetricsBatchRequest'
      responses:
        '200':
          description: Successful batch request to get metrics for multiple resources.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetricsBatchResponse'
        default:
          description: Error response describing why the operation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  parameters:
    OrderByParameter:
      name: orderBy
      in: query
      required: false
      description: The aggregation to use for sorting results and the direction of the sort.
      schema:
        type: string
    ApiVersionParameter:
      name: api-version
      in: query
      required: true
      description: Client API version.
      schema:
        type: string
        default: '2024-02-01'
    MetricNamespaceParameter:
      name: metricNamespace
      in: query
      required: true
      description: Metric namespace that contains the requested metric names.
      schema:
        type: string
    StartTimeParameter:
      name: starttime
      in: query
      required: true
      description: The start time of the query in ISO 8601 format.
      schema:
        type: string
        format: date-time
    IntervalParameter:
      name: interval
      in: query
      required: false
      description: The interval (window size) of the query in ISO 8601 duration format.
      schema:
        type: string
        default: PT1M
    AggregationParameter:
      name: aggregation
      in: query
      required: false
      description: The list of aggregation types (comma-separated) to retrieve.
      schema:
        type: string
    EndTimeParameter:
      name: endtime
      in: query
      required: true
      description: The end time of the query in ISO 8601 format.
      schema:
        type: string
        format: date-time
    TopParameter:
      name: top
      in: query
      required: false
      description: The maximum number of records to retrieve per resource.
      schema:
        type: integer
        format: int32
    FilterParameter:
      name: $filter
      in: query
      required: false
      description: The $filter used to reduce the set of metric data returned.
      schema:
        type: string
    RollUpByParameter:
      name: rollUpBy
      in: query
      required: false
      description: Dimension name(s) to rollup results by.
      schema:
        type: string
    MetricNamesParameter:
      name: metricnames
      in: query
      required: true
      description: The names of the metrics (comma-separated) to retrieve.
      schema:
        type: string
    SubscriptionIdParameter:
      name: subscriptionId
      in: path
      required: true
      description: The ID of the target subscription.
      schema:
        type: string
  schemas:
    MetricsBatchResponse:
      type: object
      properties:
        values:
          type: array
          items:
            $ref: '#/components/schemas/MetricResultsResponse'
          description: The collection of metric results for each resource.
    MetricsBatchRequest:
      type: object
      required:
      - resourceids
      properties:
        resourceids:
          type: array
          items:
            type: string
          description: The list of resource IDs to query metrics for. All resources must be in the same subscription, region, and resource type.
    Metric:
      type: object
      required:
      - id
      - type
      - name
      - unit
      - timeseries
      properties:
        id:
          type: string
          description: The metric ID.
        type:
          type: string
          description: The resource type of the metric resource.
        name:
          type: object
          properties:
            value:
              type: string
              description: The invariant value.
            localizedValue:
              type: string
              description: The display name.
          required:
          - value
        displayDescription:
          type: string
          description: Detailed description of this metric.
        unit:
          type: string
          enum:
          - Count
          - Bytes
          - Seconds
          - CountPerSecond
          - BytesPerSecond
          - Percent
          - MilliSeconds
          - ByteSeconds
          - Unspecified
          - Cores
          - MilliCores
          - NanoCores
          - BitsPerSecond
          description: The unit of the metric.
        timeseries:
          type: array
          items:
            $ref: '#/components/schemas/TimeSeriesElement'
          description: The time series returned when a data query is performed.
    TimeSeriesElement:
      type: object
      properties:
        metadatavalues:
          type: array
          items:
            type: object
            properties:
              name:
                type: object
                properties:
                  value:
                    type: string
                  localizedValue:
                    type: string
              value:
                type: string
          description: The metadata values returned.
        data:
          type: array
          items:
            $ref: '#/components/schemas/MetricValue'
          description: An array of data points representing the metric values.
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code.
        message:
          type: string
          description: Error message indicating why the operation failed.
    MetricValue:
      type: object
      required:
      - timeStamp
      properties:
        timeStamp:
          type: string
          format: date-time
          description: The timestamp for the metric value in ISO 8601 format.
        average:
          type: number
          format: double
          description: The average value in the time range.
        minimum:
          type: number
          format: double
          description: The least value in the time range.
        maximum:
          type: number
          format: double
          description: The greatest value in the time range.
        total:
          type: number
          format: double
          description: The sum of all of the values in the time range.
        count:
          type: number
          format: double
          description: The number of samples in the time range.
    MetricResultsResponse:
      type: object
      properties:
        starttime:
          type: string
          description: The start time, in datetime format, for which the data was retrieved.
        endtime:
          type: string
          description: The end time, in datetime format, for which the data was retrieved.
        interval:
          type: string
          description: The interval (window size) for which the metric data was returned.
        namespace:
          type: string
          description: The namespace of the metrics being queried.
        resourceregion:
          type: string
          description: The region of the resource being queried for metrics.
        resourceid:
          type: string
          description: The resource ID for which metrics were retrieved.
        value:
          type: array
          items:
            $ref: '#/components/schemas/Metric'
          description: The value of the collection.
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token
          scopes:
            https://management.azure.com/.default: Access Azure Management API