Azure API Management Export Bug By Design
I’ve been playing with Azure API Management for some
time now, creating POCs and lately using it for work projects.
It is a great tool, which allows you to centralize all your Microservices
or APIs, both public available or inside your On-Premise network.
Among the many features it offers, there is an Import tool that allows you to create
an API definition from a Swagger or WSDL file.
And as you would expect from a great tool, there is also an Export tool that allows you to create a
Swagger file from an existing API definition.
All great except, when you export a definition from API
Management,
you cannot re-use that definition into any API Management service
anymore.
In fact, by design (see the answer from Microsoft Azure Support below), the tool will change your
definition, duplicating parameters, and when you import it again, your new
API will throw an error when tested:
“Access denied due to invalid subscription key. Make sure to
provide a valid key for an active subscription”
So be aware of this “by-design” unexpected behavior (shall
we call it bug, really?), and make sure you clean up your exported file before (or
after through the Publisher portal) re-importing it into a new API Management
instance.
Here’s the answer from Microsoft
Azure Support:
“Looks like you are right. I just imported your swagger
file…. Then deleted all those subscription-key parameters and saved those
changes. Then when I go to export that API the subscription-key does get
injected into the query string parameters again. I’ll open up a ticket with the
product team and give them the repro. I’ll keep you updated on the
investigations.”
However…
“The product team is telling me that this is by design. We
add the Ocp-Apim-Subscription-Key
and subscription-key parameters.
They tell me that the exported swagger
file targets clients that want to call the API and that if clients are going to
call the API then they have a chance to pass in their API Subscription key using either of those parameters.
They state that the Import/Export
API feature isn’t a good backup/restore type of functionality. They do have
other functionality that supports backup/restore of the APIM service: https://docs.microsoft.com/en-us/azure/api-management/api-management-howto-disaster-recovery-backup-restore”
But all I wanted was to export an API definition from the
Export tool, and import it through the Import tool, not backing up and
restoring the whole API Management service…
Comments
Post a Comment