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: cli/azd/docs/extensions/extension-resolution-and-versioning.md
+42-29Lines changed: 42 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,51 +63,60 @@ All configured sources are loaded from `~/.azd/config.json` and sorted alphabeti
63
63
64
64
### 3. Handle Conflicts
65
65
66
-
If the same extension ID exists in **two or more sources**, `azd`returns an error rather than silently picking one:
66
+
If the same extension ID exists in **two or more sources**, `azd`handles the conflict differently depending on the mode:
67
67
68
-
```
69
-
The <id> extension was found in multiple sources.
70
-
```
68
+
-**Interactive mode** — `azd` prompts the user to choose which source to install from.
69
+
-**Non-interactive mode** (`--no-prompt` or CI environments) — `azd` returns an error:
71
70
72
-
To resolve this, specify the source explicitly:
71
+
```
72
+
The <id> extension was found in multiple sources.
73
+
```
74
+
75
+
To avoid the prompt or error, specify the source explicitly:
73
76
74
77
```bash
75
78
azd extension install <id> --source <source-name>
76
79
```
77
80
78
-
There is no priority or merge logic between sources — each extension must be unambiguously resolvable to a single source (unless `--source` is provided).
81
+
There is no priority or merge logic between sources — the `--source`flag is the only way to disambiguate programmatically.
79
82
80
83
## Version Constraints
81
84
82
85
### Constraint Syntax
83
86
84
-
When installing an extension, you can specify a version constraint using the `--version` flag. `azd` uses the [Masterminds semver](https://github.com/Masterminds/semver) library to parse and evaluate constraints.
87
+
Version constraints differ between the CLI and `azure.yaml`:
85
88
86
-
| Syntax | Example | Matches |
87
-
|--------|---------|---------|
88
-
| Exact |`1.0.0`| Only `1.0.0`|
89
-
| Caret |`^1.2.3`|`>=1.2.3, <2.0.0`|
90
-
| Tilde |`~1.2.3`|`>=1.2.3, <1.3.0`|
91
-
| Range |`>=1.0.0,<2.0.0`| Explicit lower and upper bounds |
92
-
| Latest |`latest` or omitted | Highest available version |
89
+
#### CLI `--version` flag
93
90
94
-
Examples:
91
+
The `azd extension install --version` flag accepts only an **exact version string** or **`latest`** (the default when omitted):
The `requiredVersions.extensions` section in `azure.yaml` supports the full semver constraint syntax provided by the [Masterminds semver](https://github.com/Masterminds/semver) library:
108
105
109
-
# Install the latest version (default)
110
-
azd extension install my.extension
106
+
| Syntax | Example | Matches |
107
+
|--------|---------|---------|
108
+
| Exact |`1.0.0`| Only `1.0.0`|
109
+
| Caret |`^1.2.3`|`>=1.2.3, <2.0.0`|
110
+
| Tilde |`~1.2.3`|`>=1.2.3, <1.3.0`|
111
+
| Range |`>=1.0.0,<2.0.0`| Explicit lower and upper bounds |
112
+
| Latest |`latest` or omitted | Highest available version |
113
+
114
+
```yaml
115
+
requiredVersions:
116
+
extensions:
117
+
azure.ai.agents: ">=1.0.0"
118
+
microsoft.azd.demo: "latest"
119
+
my.custom.extension: "^2.0.0"
111
120
```
112
121
113
122
### Version Selection
@@ -127,16 +136,17 @@ When `azd` resolves versions, it filters them into compatible and incompatible s
127
136
128
137
### Behavior
129
138
130
-
- If the highest version matching the user's constraint is **compatible**, it is installed normally.
131
-
- If the highest version matching the user's constraint is **incompatible**, the install fails with guidance to upgrade `azd`.
139
+
- `azd`filters out all versions whose `requiredAzdVersion` constraint is not satisfied by the running `azd` version, then selects the **highest remaining compatible version** that also matches the user's version constraint.
140
+
- If a **newer incompatible version** exists beyond the selected version, `azd` shows a **warning** suggesting the user upgrade `azd`.
141
+
- If **no compatible versions** remain after filtering, the install **fails** with guidance to upgrade `azd`. The install also fails if the user explicitly requests a specific version that is incompatible.
132
142
- If `requiredAzdVersion` is **empty or cannot be parsed**, the version is treated as compatible (fail-open). This ensures that extensions without the field remain installable.
133
143
134
144
## Install Flow
135
145
136
146
Once a version is resolved, installation proceeds through these steps:
137
147
138
148
1. **Resolve version** — Apply the version constraint against available versions, filter by `azd` compatibility, and select the highest match.
139
-
2.**Resolve dependencies** — If the extension declares dependencies, resolve each one recursively from configured sources. Dependencies follow the same conflict and version rules.
149
+
2. **Resolve dependencies** — If the extension declares dependencies, resolve each one recursively from the **same source as the parent extension**. Cross-source dependency resolution is not performed. Dependencies follow the same version and compatibility rules.
140
150
3. **Match platform artifact** — Find the artifact for the current OS and architecture. `azd` first looks for `<os>/<arch>` (for example, `linux/amd64` or `windows/amd64`). If no exact match is found, it falls back to `<os>` only (for example, `linux` or `windows`).
141
151
4. **Download** — Fetch the artifact from its URL (HTTP/HTTPS) or copy from a local file path.
142
152
5. **Validate checksum** — Verify the downloaded file against the published checksum. Supported algorithms are `sha256` and `sha512`.
@@ -167,7 +177,10 @@ Each entry maps an extension ID to a version constraint string. The same constra
167
177
168
178
- When `azd init` runs, it reads the `requiredVersions.extensions` map and installs each extension with the specified constraint.
169
179
- If the constraint value is `null` or empty, `"latest"` is used (the highest available version is installed).
170
-
- Extensions already installed at a satisfying version are not re-downloaded.
180
+
- If an extension is already installed (any version), `azd init` **skips it** — it does not check whether the installed version satisfies the configured constraint.
> **Note:** These are known limitations in the current implementation and may be addressed in future versions.
171
184
172
185
## Caching
173
186
@@ -179,7 +192,7 @@ Each entry maps an extension ID to a version constraint string. The same constra
179
192
~/.azd/cache/extensions/<source-name>.json
180
193
```
181
194
182
-
Each source has its own cache file, named after the source.
195
+
Each source has its own cache file. The filename is derived from the source name by lowercasing it and replacing any characters outside `[a-zA-Z0-9._-]` with `_`. For example, a source named `"My Source!"` would be cached as `my_source_.json`.
183
196
184
197
### Default TTL
185
198
@@ -247,7 +260,7 @@ Use pre-release suffixes for testing before a stable release:
247
260
2.0.0-rc.1
248
261
```
249
262
250
-
Pre-release versions are not selected by default when a user installs with `latest` — they must be requested explicitly with an exact version constraint.
263
+
When `latest` is specified (or the version is omitted), `azd` selects the **highest semantic version**, which can be a pre-release if it sorts higher than the latest stable version. For semver range constraints in `azure.yaml`, pre-release versions are generally excluded unless the constraint itself explicitly includes a pre-release identifier.
0 commit comments