Skip to main content

APIM bundle bulk export

What it does. Builds the Azure API Management artifact bundle of one or every publication profile, the same bundle Generate bundle downloads on the APIM configurator, and optionally uploads each one to an Azure Blob container where a deployment pipeline can collect it. Runs: when you run it, or when you schedule it as a batch job. Who looks after it: Integration administrator.

Purpose​

Generate bundle on the APIM configurator downloads one profile's bundle to your browser, which suits a person publishing by hand. A deployment pipeline needs the latest bundle in a place it can read without anyone signing in. This job builds the bundles without a browser and puts them in a Blob container, so the API surface published in Azure API Management can follow what the environment offers.

Nothing depends on this job inside Lattice. Without it, bundles are only produced when someone selects Generate bundle.

When it runs​

  • When you run it from its menu item, or on the recurrence you give it as a batch job. There is no background process for it.
  • The bundle reflects the service and OData metadata catalogs at the time of the run, so run it after the metadata refresh that follows a deployment, and after you change a profile.

Configuration and scheduling​

Open it from System administration > Periodic tasks > Lattice > APIM bundle bulk export, or with APIM bundle bulk export on the action pane of System administration > Setup > Lattice > APIM configurator.

Dialog fieldDefaultEffect
Profile nameBlankBlank exports every publication profile; a name exports only that profile. The lookup lists the profiles
Blob target connectionBlankA file ingestion connection whose storage type is Azure Blob. The lookup lists only those. Blank builds the bundles without storing them

To schedule it, expand Run in the background, set Batch processing to Yes, enter a Task description, and select Recurrence. The code sets no interval: a bundle changes only when a profile or the metadata catalogs change, so what matters is a run after each deployment's metadata refresh and after each profile change. With Batch processing left at No it runs once, now, while you wait.

The profiles themselves (APIs, endpoints, policies and environments) are set up on the APIM configurator.

How it works​

  1. The job takes the profile you named, or every profile.
  2. For each profile it builds the bundle from the profile and the current service and OData metadata catalogs, in the formats the profile selects.
  3. With a Blob target connection, it reads the connection's endpoint, container and secret and uploads the bundle to apim/<profile name>/bundle.zip in that container, replacing the previous upload. It logs "APIM bundle for profile %1 uploaded to the '%2' connection at %3."
  4. Without one, it logs "APIM bundle generated for profile %1 (%2 base64 characters) but not saved: no Blob target connection was chosen. Choose one on the next run to upload the bundle." The bundle is not kept anywhere.
  5. A profile that fails is logged with "APIM bundle bulk export failed for profile %1: %2" and the job goes on with the next one.
  6. At the end it logs "APIM bundle bulk export completed. Profiles exported: %1, failed: %2."

Before it can run​

  • At least one publication profile on the APIM configurator.
  • Filled metadata catalogs: a bundle built before the metadata refresh describes an empty or outdated API surface.
  • For an upload, a file ingestion connection with Storage type Azure Blob, an Endpoint, a Container or share and a working secret. The connection does not have to be Enabled. In a Microsoft-managed environment the secret must be stored: a key, SAS token or connection string, Encrypted or as a Key Vault parameters secret. A connection with no secret (managed identity) or with an Azure Key Vault reference is refused there before any sign-in (Key Vault and secrets).
  • The batch service, for a scheduled run.
  • The license does not stop a scheduled run. Started from the menu item while the license blocks Lattice, the job shows a license warning and does nothing.

Inputs and outputs​

ReadsWrites
The publication profiles and their APIs, endpoints, policies and environmentsapim/<profile name>/bundle.zip in the target container, one per profile, overwritten on each run
The service and OData metadata catalogsMessages in the job's log
The target connection's endpoint, container and secret

The bundle holds no secret value, and the storage secret is used only for the upload. Deploying the bundle into Azure API Management happens outside Finance and Operations.

Monitoring and logs​

  • The messages above, shown when you run it now, or in the batch job's history on System administration > Inquiries > Batch jobs.
  • The blob's last-modified time in the target container shows when each profile was last exported.

When it fails​

SymptomCauseFix
"APIM export target connection '%1' was not found."The Blob target connection was deleted after the job was scheduledSchedule the job again with an existing connection
"APIM export target connection '%1' is not an Azure Blob connection."The connection's Storage type was changedUse an Azure Blob connection
"Failed to upload the APIM bundle for profile %1: %2"The container could not be written: wrong secret, endpoint or container, or no network accessUse Test connection on the connection, then run the job again
"APIM bundle generated for profile %1 (%2 base64 characters) but not saved: no Blob target connection was chosen. ..."No Blob target connection was setRun or schedule the job again with one
The bundle is missing operations or entitiesThe metadata catalogs were not refreshed after the deploymentRun the metadata refresh, then the export

Effect on the rest of Lattice​

  • The export only reads Lattice data. It does not change profiles, connections or catalogs.
  • If the target connection is also an enabled file ingestion connection, the file ingestion pull lists every file under its Folder path, including subfolders. A blank Folder path, or one above apim/, with a File pattern that matches bundle.zip makes the pull try to ingest the bundle. Use a connection that is not enabled, or a container or folder the pull does not read.