Skip to content

[BUG] API operations not deployed when publishing extracted API from Dev to Test #818

@JProvAnt

Description

@JProvAnt

Release version

7.0.0-alpha.3.0.0

Describe the bug

Affected component
Publisher pipeline

Environment

  • Source environment: Dev
  • Target environment: Test
  • Azure API Management
  • API imported originally via Azure Portal

Description
When deploying an API from Dev to Test, the publisher pipeline completes successfully, but the API in the target APIM instance contains no operations. This occurs even though the extracted artifacts clearly contain a valid OpenAPI specification with defined paths and operations.

This appears to be a silent failure where the deployment reports success but results in an incomplete API.

openapi: 3.0.1
info:
  title: Swagger Petstore
  description: This is a sample server Petstore server.
  version: v1
servers:
  - url: https://api.be/petstore/v1
paths:
  /pet/{petId}/uploadImage:
    post:
      tags:
        - pet
      summary: uploads an image
      operationId: uploadFile
... redacted ....

Expected behavior

  • The API in the Test APIM instance should contain all operations defined in the extracted OpenAPI specification.
  • If operations cannot be deployed, the publisher pipeline should fail or emit a clear warning or error.

Actual behavior

  • Publisher pipeline completes successfully without errors.
  • API is created or updated in the Test APIM instance.
  • The API contains zero operations when viewed in the Azure Portal.
  • No warnings or errors are logged indicating that operations were skipped or failed.
Image Image

Reproduction Steps

  1. In the Azure Portal, create a new API in APIM by importing the public Swagger Petstore OpenAPI URL https://petstore.swagger.io/v2/swagger.json.
  2. Confirm that the API is successfully created in APIM with operations visible in the portal.
  3. Configure APIOps extractor configuration using the Petstore API name.
    Extractor configuration:
apis:
  - swagger-petstore

backends: []

diagnostics: []

loggers: []

named_values: []

products: []

subscriptions: []

version_sets:
  - Swagger Petstore

tags: []

policy_fragments: []

groups: []
  1. Run the extractor pipeline.
  2. Approve PR with the extracted artifacts and merge it into the target branch.
  3. Configure the APIOps publisher pipeline using the same API name and version set.
apimServiceName: apim-test
version_sets:
  - name: Swagger Petstore
    properties:
      displayName: "Swagger Petstore version set"
apis:
  - name: swagger-petstore
    properties:
      serviceUrl: https://petstore.swagger.io/test
  1. Run the publisher pipeline targeting the Test environment.

Additional Failure Scenario: Publisher fails for newly created API with single operation

Description

In a related scenario, when a brand new API with a single operation is created directly in the Azure Portal and then extracted using APIOps, the publisher pipeline fails during deployment to the target environment.

This differs from the primary issue in that the pipeline fails explicitly, rather than succeeding with missing operations, but it appears to involve the same area of operation handling.

Steps to Reproduce

  1. In the Azure Portal, create a brand new API in APIM.
  2. Add a single operation manually, for example healthcheck.
  3. Ensure the API and operation exist and function correctly in the source APIM instance.
  4. Run the APIOps extractor pipeline for this API.
  5. Merge the extracted artifacts into the target branch.
  6. Run the APIOps publisher pipeline targeting the Test environment.

Actual Behavior

The publisher pipeline fails with the following error:

##[error]Unhandled exception. System.Net.Http.HttpRequestException:
HTTP request to URI
https://management.azure.com/subscriptions/redacted/resourceGroups/redacted/providers/Microsoft.ApiManagement/service/apim-test/apis/dummy-api/operations/healthcheck/policies/policy?api-version=2024-05-01
failed with status code 400.

Content:
{"error":{"code":"ValidationError","message":"Entity with specified identifier not found","details":null}}

This suggests the publisher attempts to deploy an operation-level policy for an operation that does not yet exist in the target APIM instance.

Expected Behavior

The publisher should ensure operations are created before attempting to apply operation-level policies.

Alternatively, the publisher should fail with a clear, actionable error explaining the missing dependency.

A newly created API with a single operation should be deployable via APIOps without manual intervention.

Relationship to Primary Issue

While this scenario results in a hard failure and the primary issue results in a silent success, both appear to involve incorrect handling or ordering of API operations during publishing.

These may share a common root cause in how operations are created, updated, or referenced in the publisher pipeline.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions