Scaffold a repository with CI/CD pipelines, configuration templates, and identity setup guides for APIOps workflows.
apiops init [options]apiops initYou'll be prompted to select a CI/CD platform and configure environments.
apiops init --ci github-actions --non-interactiveapiops init --ci azure-devops --environments dev,staging,prod --non-interactiveapiops init --ci github-actions --non-interactive --forceapiops init --ci github-actions --artifact-dir ./my-artifacts --non-interactive| Flag | Type | Default | Required | Description |
|---|---|---|---|---|
--ci <provider> |
string | — | No | CI/CD provider: github-actions or azure-devops |
--non-interactive |
boolean | false |
No | Skip interactive prompts (requires --ci) |
--artifact-dir <dir> |
string | ./apim-artifacts |
No | Artifact directory path |
--environments <list> |
string | dev,prod |
No | Comma-separated environment names |
--cli-package <path> |
string | — | No | Path to apiops npm tarball (from npm pack) |
--force |
boolean | false |
No | Overwrite existing files without prompting |
Note: When
--non-interactiveis set,--ciis required.
flowchart TD
A[apiops init] --> B{TTY detected?}
B -->|Yes| C[Interactive Mode: Prompt for CI platform, environments]
B -->|No| D[Non-Interactive Mode: Read flags]
C --> E[Detect existing files]
D --> E
E --> F{Conflicts found?}
F -->|Yes, no --force| G[Exit with error listing conflicts]
F -->|Yes, with --force| H[Warn and overwrite]
F -->|No conflicts| I[Generate files]
H --> I
I --> J[Output: Pipeline YAML, override templates, identity setup guide]
In interactive mode (the default when running in a terminal), apiops init prompts you to choose a CI/CD platform and configure environment names. In non-interactive mode (CI environments or when using --non-interactive), all options must be provided via flags.
| File | Purpose |
|---|---|
.github/workflows/run-apiops-extractor.yml |
Workflow to extract APIM artifacts |
.github/workflows/run-apiops-publisher.yml |
Workflow to publish artifacts to APIM |
configuration.extractor.yaml |
Sample filter configuration for extraction |
configuration.{env}.yaml |
Override templates per environment (e.g., configuration.dev.yaml, configuration.prod.yaml) |
.github/prompts/apiops-setup-workflow-identity.prompt.md |
Copilot prompt for GitHub Actions identity setup |
APIOPS-WORKFLOW-IDENTITY-SETUP.md |
Step-by-step guide for configuring GitHub Actions Azure access and workflow identity |
| File | Purpose |
|---|---|
.azdo/pipelines/run-apiops-extractor.yml |
Pipeline to extract APIM artifacts |
.azdo/pipelines/run-apiops-publisher.yml |
Pipeline to publish artifacts to APIM |
configuration.extractor.yaml |
Sample filter configuration for extraction |
configuration.{env}.yaml |
Override templates per environment |
.github/prompts/apiops-setup-pipeline-identity.prompt.md |
Copilot prompt for Azure DevOps identity setup |
APIOPS-PIPELINE-IDENTITY-SETUP.md |
Step-by-step guide for configuring Azure DevOps pipeline identity and repo permissions |
| File | Purpose |
|---|---|
.github/prompts/apiops-configure-filter.prompt.md |
Copilot prompt for creating extraction filter files |
.github/prompts/apiops-configure-overrides.prompt.md |
Copilot prompt for creating environment override files |
<artifact-dir>/ |
Empty artifact directory (default: ./apim-artifacts) |
By default, generated pipeline files reference the published npm package @azure-tools/apiops-cli. This is the standard consumption pattern — no local files are needed.
If you pass --cli-package <path>, the tarball is copied into a .apiops/ directory and the generated package.json references it as a local file dependency. This mode is useful for local development and testing before the package is published to npm.
apiops init checks for existing files before writing. If conflicts are found:
- Without
--force: exits with an error listing the conflicting files. - With
--force: warns about each conflict, then overwrites.
- Set up identity — Follow the generated
APIOPS-*-IDENTITY-SETUP.mdguide or provider-specific Copilot prompt to configure Azure credentials for your CI/CD platform. - Extract your first snapshot — Run
apiops extractto pull your current APIM configuration into the artifact directory. - Configure filters — Edit
configuration.extractor.yamlto control which resources are extracted. Use the.github/prompts/apiops-configure-filter.prompt.mdCopilot prompt for guided setup. - Commit and push — Check the generated files into version control.
- Configure overrides — Edit
configuration.{env}.yamlfiles with environment-specific values. Use the.github/prompts/apiops-configure-overrides.prompt.mdCopilot prompt for guided setup. See the environment overrides guide. - Run your pipeline — Trigger the publish pipeline to deploy artifacts to your target APIM instance.
- apiops extract — extract APIM configuration to local files
- apiops publish — publish artifacts to APIM
- GitHub Actions integration
- Azure DevOps integration
- Environment overrides guide
- Authentication guide