Microsoft Bicep Template Specs API

Manage Template Spec resources for reusable Bicep templates

OpenAPI Specification

microsoft-bicep-template-specs-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Microsoft Bicep Deployments Template Specs API
  description: Azure Resource Manager Deployments REST API used by Microsoft Bicep to deploy infrastructure as code templates. Provides operations for creating, validating, and managing ARM/Bicep template deployments at resource group, subscription, management group, and tenant scopes.
  version: '2025-04-01'
  contact:
    name: Microsoft Azure Support
    url: https://azure.microsoft.com/en-us/support/
  license:
    name: MIT
    url: https://github.com/Azure/bicep/blob/main/LICENSE
  termsOfService: https://azure.microsoft.com/en-us/support/legal/
servers:
- url: https://management.azure.com
  description: Azure Resource Manager Global Endpoint
security:
- azure_auth:
  - user_impersonation
tags:
- name: Template Specs
  description: Manage Template Spec resources for reusable Bicep templates
paths:
  ? /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs/{templateSpecName}
  : put:
      operationId: TemplateSpecs_CreateOrUpdate
      summary: Microsoft Bicep Create or update a Template Spec
      description: Creates or updates a Template Spec. Template Specs enable you to store compiled Bicep templates as Azure resources for reuse and sharing.
      tags:
      - Template Specs
      parameters:
      - $ref: '#/components/parameters/subscriptionId'
      - $ref: '#/components/parameters/resourceGroupName'
      - $ref: '#/components/parameters/templateSpecName'
      - $ref: '#/components/parameters/apiVersion'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TemplateSpec'
      responses:
        '200':
          description: Template Spec updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateSpec'
        '201':
          description: Template Spec created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateSpec'
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateSpecsError'
    get:
      operationId: TemplateSpecs_Get
      summary: Microsoft Bicep Get a Template Spec
      description: Gets a Template Spec with a given name.
      tags:
      - Template Specs
      parameters:
      - $ref: '#/components/parameters/subscriptionId'
      - $ref: '#/components/parameters/resourceGroupName'
      - $ref: '#/components/parameters/templateSpecName'
      - $ref: '#/components/parameters/apiVersion'
      - name: $expand
        in: query
        description: Allows for expansion of additional Template Spec details. Set to 'versions' to include version information.
        schema:
          type: string
          enum:
          - versions
      responses:
        '200':
          description: Template Spec details returned successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateSpec'
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateSpecsError'
    patch:
      operationId: TemplateSpecs_Update
      summary: Microsoft Bicep Update Template Spec tags
      description: Updates Template Spec tags with specified values.
      tags:
      - Template Specs
      parameters:
      - $ref: '#/components/parameters/subscriptionId'
      - $ref: '#/components/parameters/resourceGroupName'
      - $ref: '#/components/parameters/templateSpecName'
      - $ref: '#/components/parameters/apiVersion'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TemplateSpecUpdateModel'
      responses:
        '200':
          description: Template Spec updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateSpec'
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateSpecsError'
    delete:
      operationId: TemplateSpecs_Delete
      summary: Microsoft Bicep Delete a Template Spec
      description: Deletes a Template Spec by name. When the operation completes, status code 200 is returned without content.
      tags:
      - Template Specs
      parameters:
      - $ref: '#/components/parameters/subscriptionId'
      - $ref: '#/components/parameters/resourceGroupName'
      - $ref: '#/components/parameters/templateSpecName'
      - $ref: '#/components/parameters/apiVersion'
      responses:
        '200':
          description: Template Spec deleted successfully
        '204':
          description: Template Spec not found (already deleted)
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateSpecsError'
  /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/templateSpecs:
    get:
      operationId: TemplateSpecs_ListByResourceGroup
      summary: Microsoft Bicep List Template Specs by resource group
      description: Lists all the Template Specs within the specified resource group.
      tags:
      - Template Specs
      parameters:
      - $ref: '#/components/parameters/subscriptionId'
      - $ref: '#/components/parameters/resourceGroupName'
      - $ref: '#/components/parameters/apiVersion'
      - name: $expand
        in: query
        description: Allows for expansion of additional Template Spec details. Set to 'versions' to include version information.
        schema:
          type: string
          enum:
          - versions
      responses:
        '200':
          description: List of Template Specs returned successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateSpecListResult'
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateSpecsError'
  /subscriptions/{subscriptionId}/providers/Microsoft.Resources/templateSpecs:
    get:
      operationId: TemplateSpecs_ListBySubscription
      summary: Microsoft Bicep List Template Specs by subscription
      description: Lists all the Template Specs within the specified subscription.
      tags:
      - Template Specs
      parameters:
      - $ref: '#/components/parameters/subscriptionId'
      - $ref: '#/components/parameters/apiVersion'
      - name: $expand
        in: query
        description: Allows for expansion of additional Template Spec details. Set to 'versions' to include version information.
        schema:
          type: string
          enum:
          - versions
      responses:
        '200':
          description: List of Template Specs returned successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateSpecListResult'
        default:
          description: Error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateSpecsError'
components:
  schemas:
    TemplateSpecsError:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ErrorResponse'
    ErrorResponse:
      type: object
      properties:
        code:
          type: string
          description: The error code
        message:
          type: string
          description: The error message
        target:
          type: string
          description: The error target
        details:
          type: array
          items:
            $ref: '#/components/schemas/ErrorResponse'
          description: The error details
        additionalInfo:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                description: The additional info type
              info:
                type: object
                description: The additional info
          description: The error additional info
    TemplateSpecVersionInfo:
      type: object
      properties:
        description:
          type: string
          description: Template Spec version description
        timeCreated:
          type: string
          format: date-time
          readOnly: true
          description: The timestamp of when the version was created
        timeModified:
          type: string
          format: date-time
          readOnly: true
          description: The timestamp of when the version was last modified
    TemplateSpecUpdateModel:
      type: object
      properties:
        tags:
          type: object
          additionalProperties:
            type: string
          description: Resource tags
    SystemData:
      type: object
      properties:
        createdBy:
          type: string
          description: The identity that created the resource
        createdByType:
          type: string
          enum:
          - User
          - Application
          - ManagedIdentity
          - Key
          description: The type of identity that created the resource
        createdAt:
          type: string
          format: date-time
          description: The timestamp of resource creation (UTC)
        lastModifiedBy:
          type: string
          description: The identity that last modified the resource
        lastModifiedByType:
          type: string
          enum:
          - User
          - Application
          - ManagedIdentity
          - Key
          description: The type of identity that last modified the resource
        lastModifiedAt:
          type: string
          format: date-time
          description: The timestamp of resource last modification (UTC)
    TemplateSpec:
      type: object
      required:
      - location
      properties:
        id:
          type: string
          readOnly: true
          description: String ID used to locate any resource on Azure
        name:
          type: string
          readOnly: true
          description: Name of this resource
        type:
          type: string
          readOnly: true
          description: Type of this resource
        location:
          type: string
          description: The location of the Template Spec. It cannot be changed after Template Spec creation.
        tags:
          type: object
          additionalProperties:
            type: string
          description: Resource tags
        systemData:
          $ref: '#/components/schemas/SystemData'
        properties:
          type: object
          properties:
            description:
              type: string
              maxLength: 4096
              description: Template Spec description
            displayName:
              type: string
              maxLength: 64
              description: Template Spec display name
            metadata:
              type: object
              description: The Template Spec metadata. Metadata is an open-ended object and is typically a collection of key-value pairs.
            versions:
              type: object
              readOnly: true
              additionalProperties:
                $ref: '#/components/schemas/TemplateSpecVersionInfo'
              description: High-level information about the versions within this Template Spec. Only populated if $expand query parameter is set to 'versions'.
    TemplateSpecListResult:
      type: object
      properties:
        value:
          type: array
          items:
            $ref: '#/components/schemas/TemplateSpec'
          description: Array of Template Specs
        nextLink:
          type: string
          format: uri
          readOnly: true
          description: URL to get the next set of results
  parameters:
    templateSpecName:
      name: templateSpecName
      in: path
      required: true
      description: Name of the Template Spec
      schema:
        type: string
        minLength: 1
        maxLength: 90
        pattern: ^[-\w\.\_\(\)]+$
    subscriptionId:
      name: subscriptionId
      in: path
      required: true
      description: Subscription ID which forms part of the URI for every service call
      schema:
        type: string
    resourceGroupName:
      name: resourceGroupName
      in: path
      required: true
      description: The name of the resource group. The name is case insensitive.
      schema:
        type: string
        minLength: 1
        maxLength: 90
        pattern: ^[-\w\.\_\(\)]+$
    apiVersion:
      name: api-version
      in: query
      required: true
      description: Client API version
      schema:
        type: string
        default: '2021-05-01'
  securitySchemes:
    azure_auth:
      type: oauth2
      description: Azure Active Directory OAuth2 Flow
      flows:
        implicit:
          authorizationUrl: https://login.microsoftonline.com/common/oauth2/authorize
          scopes:
            user_impersonation: Impersonate your user account
externalDocs:
  description: Azure Resource Manager Deployments API Documentation
  url: https://learn.microsoft.com/en-us/rest/api/resources/deployments