You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/commands/extract.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,14 +94,17 @@ For local development, `az login` is the simplest option. For CI/CD pipelines, u
94
94
95
95
By default, `apiops extract` exports **all** resources from the APIM instance (34 resource types including APIs, products, backends, named values, tags, policies, and more).
96
96
97
-
To extract only specific resources, pass a YAML filter file with `--filter`. Filter entries support exact names and wildcard patterns (`*` for any characters, `?` for a single character):
97
+
To extract only specific resources, pass a YAML filter file with `--filter`. Filter entries support exact names, wildcard patterns (`*` for any characters, `?` for a single character), and `!`-prefixed **exclusions** (e.g. `'!prod-legacy'` — see [`filtering-resources.md`](../guides/filtering-resources.md#excluding-resources-with-) for details):
98
+
99
+
> **Always quote `!`-prefixed entries** — unquoted `- !prod-legacy` is parsed by YAML as a tag and fails to load.
98
100
99
101
```yaml
100
102
# configuration.extractor.yaml
101
103
apis:
102
104
- echo-api
103
105
- petstore-api
104
106
- 'prod-*'# Wildcard: all APIs starting with prod-
Copy file name to clipboardExpand all lines: docs/guides/filtering-resources.md
+49Lines changed: 49 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -86,6 +86,7 @@ namedValues:
86
86
- Names are matched case-insensitively against APIM resource names
87
87
- Wildcard patterns are supported — `*` matches any characters, `?` matches a single character (see below)
88
88
- Exact names and wildcard patterns can be mixed in the same array
89
+
- Entries beginning with `!` are **exclusions** — see [Excluding resources with `!`](#excluding-resources-with-) below
89
90
- An empty file extracts everything (same as no filter)
90
91
- An empty array (`[]`) excludes ALL resources of that type
91
92
@@ -125,6 +126,54 @@ Wildcard matching is case-insensitive, just like exact matching. Special charact
125
126
126
127
---
127
128
129
+
## Excluding resources with `!`
130
+
131
+
Any filter entry whose first character is `!` is treated as an **exclusion**. Exclusions are applied *after* inclusions for the same list, so you can write patterns like "include everything matching this shape, except these specific ones."
132
+
133
+
Semantics:
134
+
135
+
- `!`must be the **first character** of the entry to count as negation. `foo!bar` is a literal name.
136
+
- The rest of the entry is a normal filter value — exact name or wildcard pattern, matched case-insensitively.
137
+
- A resource is included iff at least one inclusion matches it **and** no exclusion matches it.
138
+
- A list containing only exclusions is treated as "include everything, then subtract" — equivalent to prepending an implicit `*`.
139
+
- Exclusions respect the same semantics as inclusions: they match API root names (stripping revision suffixes), and excluding a parent (Api, Product, Gateway, Workspace) cascades to its children.
140
+
141
+
> **Always quote `!`-prefixed entries in YAML.** An unquoted leading `!` (e.g. `- !prod-legacy-billing`) is parsed by YAML as a **tag** and produces an "unknown tag" error before the filter code ever sees the value. Wrap the entry in single or double quotes, exactly like the examples in this guide: `- '!prod-legacy-billing'`.
142
+
143
+
### Examples
144
+
145
+
```yaml
146
+
# Include all prod-* APIs except one specific legacy API and any deprecated variants
147
+
apis:
148
+
- 'prod-*'
149
+
- '!prod-legacy-billing'
150
+
- '!prod-*-deprecated'
151
+
152
+
# Include every backend except the shared infra ones
153
+
backends:
154
+
- '*'
155
+
- '!shared-monitoring'
156
+
- '!shared-*-infra'
157
+
158
+
# Include every named value except Key Vault-backed ones (pure-exclusion list)
159
+
namedValues:
160
+
- '!keyvault-*'
161
+
```
162
+
163
+
Exclusions work anywhere a string list is accepted, including sub-filter fields inside `apiSubFilters` and `workspaceSubFilters`:
164
+
165
+
```yaml
166
+
apis:
167
+
- 'my-api'
168
+
apiSubFilters:
169
+
my-api:
170
+
operations:
171
+
- 'get-*'
172
+
- '!get-internal-*' # keep all get-* operations except internal ones
Copy file name to clipboardExpand all lines: src/templates/copilot/configure-filter-prompt.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ Walk through the resource types **one type at a time**. For each type, ask the u
47
47
48
48
-**Extract ALL** — include every resource of this type. Leave this type **out** of the filter (APIOps extracts everything by default).
49
49
-**Extract NONE** — exclude all resources of this type. Add the type with an empty array: `tags: []`.
50
-
-**Extract SOME** — include only specific resources. The user provides which names (or wildcard patterns) to include. Matching is case-insensitive and supports `*` and `?` wildcards.
50
+
-**Extract SOME** — include only specific resources. The user provides which names (or wildcard patterns) to include. Matching is case-insensitive and supports `*` and `?` wildcards. Entries can also be prefixed with `!` to **exclude** a name or pattern (e.g. `'!prod-legacy-*'`); a list containing only `!` entries means "include everything, then subtract." **Always quote `!`-prefixed entries in YAML** — an unquoted leading `!` is parsed as a YAML tag and fails to load.
0 commit comments