Migrating managed Developer portal between APIM services

The developer portal supports programmatic access to content. It allows you to extract the data from or upload it to your API Management service through the content management REST API

To simplify automation of this process, a script has been prepared for that purpose which is available here scripts.v2/migrate.js.

It exports the content of the developer portal from one API Management service and imports it into the developer portal of another API Management service - for example, exports from a test environment and imports into the production environment.

Let’s get started!

Link referenced

In order to initiate the migration process, you need to:

  1. Clone the api-management-developer-portal repository locally.

2. `npm install` in the root of the project.

3. Change directory (cd) into the scripts folder.

3. Then run the script with a valid combination of arguments

Managed portal command example:

Managed portal command

Pre — Execution

You need to provide the required parameters to run the script: source management API endpoints, destination management API endpoints, destination developer portal URL, source SAS token, destination SAS token.

Source Management API endpoint & Source SAS Token
Destination Management API endpoint & Destination SAS Token
Destination Developer Portal URL

Input all the required parameters in the managed portal command on a note pad.

Execution

The script performs the following steps:

  1. Capture the portal content from the source API Management service (excl. media)
  2. Remove the portal content from the destination API Management service (incl. media)
  3. Upload the portal content to the destination API Management service (excl. media)
  4. Download the portal’s media files from the source API Management service
  5. Upload the portal’s media files to the destination API Management service
  6. (Optional) If you’re using a managed portal, you can set the script to auto-publish the destination portal to make the migrated version automatically available to the visitors

Clone the repository which contains the source code of the developer portal locally.

From your command prompt, now cd into the cloned folder

run npm install

NPM Install

Once all the dependencies have been installed.

Then run the managed portal command with a valid combination of arguments as seen below

With that, be rest assured all contents (including media) have been migrated to the destination portal.

Post — Execution

After the script is successfully executed, the destination developer portal should contain the same content as the source developer portal.

Source Developer Portal

Although you’ll be able to see it as an administrator, the script doesn’t publish the portal of the target service to external visitors.

You need to publish the portal through its administrative user interface bounded in red box. You can find instructions to do so here.

Destination Developer Portal only visible as administrator

Now Click on Operations > Publish Website

Voila! The published target APIM service developer portal publicly available to external visitors.

Target APIM Service Developer Portal Publicly available to external visitors.

Conclusion

We have been able to successfully export the content of the developer portal from one API Management service and imports it into another API Management service with this guide.

Feel free to let me know if this guide was helpful. I am available on Twitter.

Enterprise Cloud Solutions Architect / Dev Ops Enthusiast.