Issue with OpenAPI file import in APIM

SALOMONE ANTONIO 0 Reputation points
2025-04-23T10:46:57.2+00:00

Hi,

I'm trying to create an API by importing an OpenAPI yaml file, already validated with https://editor.swagger.io/ but I'm received the following errors:

Code: ValidationError

    *Message: URL template is invalid*

    *Target: value[8].urlTemplate    (ValidationError) URL template is invalid*

    *Code: ValidationError*

    *Message: URL template is invalid*

    *Target: value[9].urlTemplate    (ValidationError) URL template is invalid*

    *Code: ValidationError*

    *Message: URL template is invalid*

    *Target: value[10].urlTemplate   (ValidationError) URL template is invalid*

    *Code: ValidationError*

    *Message: URL template is invalid*

    *Target: value[11].urlTemplate   (ValidationError) All template parameters used in the UriTemplate must be defined in the Operation 'Container_SetMetadata', and vice-versa.*

    *Code: ValidationError*

    *Message: All template parameters used in the UriTemplate must be defined in the Operation 'Container_SetMetadata', and vice-versa.*

    *Target: value[11]       (ValidationError) URL template is invalid*

It seems additional requirements are checked for other the ones required by OpenAPI standard. Please see the here attached OpenAPI file I'm using: blob_openapi.yaml.txt

This is the az cli command I've ran:

APIMServiceName="My_APIM_Resopurce"

ResourceGroupName="My_Resource_Group"

APIId="azure-blob-storage"

APIPath="blob"

SpecificationFormat="OpenApi"

SpecificationPath="blob_openapi.yaml"

az apim api import --path $APIPath --resource-group $ResourceGroupName --service-name $APIMServiceName --api-id $APIId --specification-format $SpecificationFormat --specification-path $SpecificationPath

Thanks

Antonio

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,385 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Alex Burlachenko 4,875 Reputation points
    2025-04-28T07:28:35.11+00:00

    Hi Antonio,

    Thank you for reaching out. The errors indicate URL template validation issues in your OpenAPI file. Azure API Management has specific requirements for URL templates and parameter definitions.

    For guidance, please refer to Microsoft’s official documentation:

    Import an OpenAPI specification

    API Management policies for URL handling

    Ensure all template parameters in your paths are explicitly defined in the corresponding operations.

    
    Best regards,
    Alex
    PS If my answer help to you, please Accept my answer.
    PPS that is my answer and it is not a comment :)
    
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.