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 field | Default | Effect |
|---|---|---|
| Profile name | Blank | Blank exports every publication profile; a name exports only that profile. The lookup lists the profiles |
| Blob target connection | Blank | A 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
- The job takes the profile you named, or every profile.
- For each profile it builds the bundle from the profile and the current service and OData metadata catalogs, in the formats the profile selects.
- With a Blob target connection, it reads the connection's endpoint, container and secret and uploads the
bundle to
apim/<profile name>/bundle.zipin that container, replacing the previous upload. It logs "APIM bundle for profile %1 uploaded to the '%2' connection at %3." - 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.
- 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.
- 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
| Reads | Writes |
|---|---|
| The publication profiles and their APIs, endpoints, policies and environments | apim/<profile name>/bundle.zip in the target container, one per profile, overwritten on each run |
| The service and OData metadata catalogs | Messages 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
| Symptom | Cause | Fix |
|---|---|---|
| "APIM export target connection '%1' was not found." | The Blob target connection was deleted after the job was scheduled | Schedule the job again with an existing connection |
| "APIM export target connection '%1' is not an Azure Blob connection." | The connection's Storage type was changed | Use 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 access | Use 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 set | Run or schedule the job again with one |
| The bundle is missing operations or entities | The metadata catalogs were not refreshed after the deployment | Run 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 matchesbundle.zipmakes the pull try to ingest the bundle. Use a connection that is not enabled, or a container or folder the pull does not read.