Skip to content
Merged
13 changes: 13 additions & 0 deletions cli/azd/extensions/azure.ai.rle/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Release History

## 0.3.0-preview (Unreleased)
Comment thread
farhann1 marked this conversation as resolved.

- Add `azd ai rle list` to list environments in the configured Foundry project.
- Add `azd ai rle show <environment-name>` to inspect an environment's full details and version history.
- Allow `azd ai rle invoke <environment-name>` to invoke an existing project environment without local source or state, with optional `--version` selection.
- Rename `azd ai rle deploy` to `azd ai rle publish` to avoid confusion with the core `azd deploy` command.
- Add `--version-bump` to `azd ai rle publish` so users can choose major, minor, or patch environment versioning.
- Use the Foundry project endpoint for project-relative RLE environment and sandbox APIs.
- Authenticate Foundry API requests with Azure credentials from `az login`, `azd auth login`, or another supported development credential.
- Send the required `2025-11-15-preview` Foundry data-plane API version.
- Support versioned environment deployments and sandbox `baseUrl` invocation.
- Wait for asynchronous disk-image conversion before leasing a sandbox and surface conversion failures directly.

## 0.1.0-preview

- Initial preview scaffold for the RLE extension with `init`, `run`, `invoke`, `deploy`, and `version` commands.
149 changes: 110 additions & 39 deletions cli/azd/extensions/azure.ai.rle/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Azure AI RLE extension for azd

Quickstart for the `azd ai rle` preview extension. The extension manages an OpenEnv-style RLE environment lifecycle: init, build and run the environment container, test it through a playground UI or shell, and deploy the environment image to the RLE control plane.
Quickstart for the `azd ai rle` preview extension. The extension manages an OpenEnv-style RLE environment lifecycle: init, build and run the environment container, test it through a playground UI or shell, and publish the environment image to the RLE control plane through your Foundry project endpoint.

## Prerequisites

Install:

- Azure Developer CLI (`azd`): https://learn.microsoft.com/azure/developer/azure-developer-cli/install-azd
- Azure CLI (`az`): https://learn.microsoft.com/cli/azure/install-azure-cli
- Docker Desktop: https://www.docker.com/products/docker-desktop/
- Go, if building from source: https://go.dev/doc/install
- Git, if building from source: https://git-scm.com/downloads
Expand All @@ -16,18 +17,21 @@ Verify:
```powershell
azd version
docker version
az version
```

## Install the extension from this checkout
Sign in with Azure CLI before calling the Foundry project APIs:

From `cli\azd\extensions\azure.ai.rle`:
```powershell
az login
```

The extension also supports credentials from `azd auth login` and the other development credentials in Azure's default credential chain.

## Install the extension from the nightly registry

```powershell
azd extension install microsoft.azd.extensions
azd x build
azd x pack
azd x publish
azd extension install azure.ai.rle --source local --force
azd ext install azure.ai.rle -s https://aka.ms/azd/extensions/registry/nightly
```

Verify:
Expand All @@ -37,38 +41,42 @@ azd ai rle --help
azd ai rle version
```

After code changes, rerun:
`version` is always available. The lifecycle commands are preview-gated; if commands such as `init`, `run`, `publish`, `list`, `show`, or `invoke` are hidden, enable the preview flag in your terminal:

```powershell
azd x build
azd x pack
azd x publish
azd extension install azure.ai.rle --source local --force
$env:AZD_AI_RLE_ENABLE = "true"
```

## Configure the RLE control plane
## Configure the Foundry project endpoint

The extension defaults to the local RLE control plane at `http://localhost:5000`. To target another control plane:
RLE control-plane APIs are called relative to the Foundry project endpoint. APIM maps the project endpoint request to the workspace-scoped RLE service internally, so the extension does not require a separate control-plane endpoint.

Set the Foundry project endpoint once in the terminal where you run `publish`:

```powershell
$env:RLE_ENDPOINT = "https://<rle-control-plane>"
$env:FOUNDRY_PROJECT_ENDPOINT = "https://<account>.services.ai.azure.com/api/projects/<project>"
```

For example, RLE environment registration is sent to:

```text
<FOUNDRY_PROJECT_ENDPOINT>/fine_tuning/environments?api-version=2025-11-15-preview
```

Deploy uses a Foundry project endpoint and an ACR image for the registered RLE environment. Set them once:
Publish also needs an ACR registry endpoint:

```powershell
$env:FOUNDRY_PROJECT_ENDPOINT = "https://<account>.services.ai.azure.com/api/projects/<project>"
$env:AZURE_CONTAINER_REGISTRY_ENDPOINT = "<registry>.azurecr.io"
```

## Quickstart

Discovery for all commands is currently disabled using `AZD_AI_RLE_ENABLE`. To enable:
Authenticate Docker to ACR before deploying:

```powershell
$env:AZD_AI_RLE_ENABLE = "true"
az acr login --name <registry>
```

## Quickstart

### 1. Initialize an environment session

Default echo session:
Expand All @@ -78,8 +86,7 @@ azd ai rle init
cd .\echo_env
```

The default echo session downloads the Hugging Face `OpenEnv` repo, copies `envs/echo_env` into the session folder,
and writes `.azd-rle.json` with the local environment name.
The default echo session downloads the Hugging Face `OpenEnv` repo, copies `envs/echo_env` into the session folder, and writes `.azd-rle.json` with the local environment name.

The copied session does not keep `.git` metadata from the upstream repository.

Expand All @@ -97,21 +104,17 @@ For an existing source folder, skip `init` and run commands directly from that f
azd ai rle run
```

`run` builds a local Docker image from the current source folder, removes any stale local container for the
same environment name, starts a fresh container, waits for `/health`, opens the playground UI at `/web`, and
keeps an OpenEnv shell attached. When the shell exits or Ctrl+C is received, `run` removes the local container.
`run` builds a local Docker image from the current source folder, removes any stale local container for the same environment name, starts a fresh container, waits for `/health`, opens the playground UI at `/web`, and keeps an OpenEnv shell attached. When the shell exits or Ctrl+C is received, `run` removes the local container.

If `.azd-rle.json`
does not exist, `run` creates it with only the inferred local environment name.
If `.azd-rle.json` does not exist, `run` creates it with only the inferred local environment name.

Use a custom host port:

```powershell
azd ai rle run --port 9000
```

`run` looks for `Dockerfile` at the source root, then `server\Dockerfile`. If the Dockerfile is elsewhere,
pass it explicitly:
`run` looks for `Dockerfile` at the source root, then `server\Dockerfile`. If the Dockerfile is elsewhere, pass it explicitly:

```powershell
azd ai rle run --dockerfile server\Dockerfile
Expand Down Expand Up @@ -145,28 +148,96 @@ Supported shell commands:
| `schema` | `GET /schema` |
| `exit` / `quit` | Exit shell |

### 3. Deploy/register
### 3. Publish/register

```powershell
$env:FOUNDRY_PROJECT_ENDPOINT = "https://<account>.services.ai.azure.com/api/projects/<project>"
$env:AZURE_CONTAINER_REGISTRY_ENDPOINT = "<registry>.azurecr.io"
azd ai rle deploy
azd ai rle publish --version-bump major
```

Deploy reads the Foundry project endpoint from `FOUNDRY_PROJECT_ENDPOINT` and the ACR registry from `AZURE_CONTAINER_REGISTRY_ENDPOINT` in the terminal environment. It derives the project route segment from `/api/projects/<project>`, builds the Docker image as `<registry>.azurecr.io/<project>-<environment>:latest`, pushes it to ACR, registers that image with the RLE control plane, and saves the project/environment details in `.azd-rle.json`.
The deploy command prints a CLI-friendly summary using `environmentId`, `acrImage`, `version`, `createdAt`, and `updatedAt`.
Publish reads the Foundry project endpoint from `FOUNDRY_PROJECT_ENDPOINT` and the ACR registry from `AZURE_CONTAINER_REGISTRY_ENDPOINT`. It derives the project route segment from `/api/projects/<project>`, builds the Docker image as `<registry>.azurecr.io/<project>-<environment>:latest`, pushes it to ACR, registers that image by calling `<FOUNDRY_PROJECT_ENDPOINT>/fine_tuning/environments`, and saves the project/environment details in `.azd-rle.json`.

Use `--version-bump major` (default), `--version-bump minor`, or `--version-bump patch` to control the environment version that RLE creates.

The publish command prints a CLI-friendly summary using `environmentId`, `foundryProjectEndpoint`, `acrImage`, `environmentVersion`, `createdAt`, and `updatedAt`.

If needed, override the Dockerfile path the same way as local run:

```powershell
azd ai rle deploy --dockerfile server\Dockerfile
azd ai rle publish --dockerfile server\Dockerfile
```

### 4. List deployed environments

List all RLE environments in the configured Foundry project:

```powershell
azd ai rle list
```

The command uses `FOUNDRY_PROJECT_ENDPOINT` when it is set. Otherwise, it uses the project endpoint saved in the current folder's `.azd-rle.json`. Use JSON output for scripting:

```powershell
azd ai rle list --output json
```

### 4. Invoke remotely
### 5. Show environment details

Remote invoke uses the deployed environment, leases a sandbox, opens the sandbox `/web` UI when available
(or a local proxy UI otherwise), keeps the shell attached, and releases the sandbox when the shell exits:
Show the full details for a specific environment, including version history:

```powershell
azd ai rle show code_rl
```

When run from a published environment folder, the environment name and Foundry
project endpoint can come from `.azd-rle.json`. Environment details and version
history are still retrieved from the Foundry APIs:

```powershell
azd ai rle show
```

### 6. Invoke remotely

Remote invoke uses the deployed environment, leases a sandbox from `<FOUNDRY_PROJECT_ENDPOINT>/fine_tuning/environments/<environmentId>/sandboxes/lease`, opens the sandbox `/web` UI when available (or a local proxy UI otherwise), keeps the shell attached, and releases the sandbox when the shell exits:

```powershell
azd ai rle invoke --timeout 60
```

To invoke an existing environment without its source code or `.azd-rle.json`, set the Foundry project endpoint and provide the environment name:

```powershell
$env:FOUNDRY_PROJECT_ENDPOINT = "https://<account>.services.ai.azure.com/api/projects/<project>"
azd ai rle invoke code_rl
```

The command resolves the latest version and environment ID returned by the project. Pin a specific published version when needed:

```powershell
azd ai rle invoke code_rl --version 2.1.0
```

Cloud-only invocation does not create or modify `.azd-rle.json`. If the selected disk image is not ready, invoke fails with a user-facing error instead of waiting.

## Build and install from source

Use this path only when you are developing the extension itself. From `cli\azd\extensions\azure.ai.rle`:

```powershell
azd extension install microsoft.azd.extensions
azd x build
azd x pack
azd x publish
azd extension install azure.ai.rle --source local --force
```

After code changes, rerun:

```powershell
azd x build
azd x pack
azd x publish
azd extension install azure.ai.rle --source local --force
```
14 changes: 10 additions & 4 deletions cli/azd/extensions/azure.ai.rle/extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,23 @@ tags:
- ai
- rle
usage: $env:AZD_AI_RLE_ENABLE = "true"; azd ai rle <command> [options]
version: 0.1.0-preview
version: 0.3.0-preview
examples:
- name: init
description: Copy the OpenEnv echo sample into a local RLE environment.
usage: $env:AZD_AI_RLE_ENABLE = "true"; azd ai rle init
- name: deploy
- name: publish
description: Build, push, and create or update the RLE environment.
usage: $env:AZD_AI_RLE_ENABLE = "true"; $env:FOUNDRY_PROJECT_ENDPOINT = "https://<account>.services.ai.azure.com/api/projects/<project>"; $env:AZURE_CONTAINER_REGISTRY_ENDPOINT = "<registry>.azurecr.io"; azd ai rle deploy
usage: $env:AZD_AI_RLE_ENABLE = "true"; $env:FOUNDRY_PROJECT_ENDPOINT = "https://<account>.services.ai.azure.com/api/projects/<project>"; $env:AZURE_CONTAINER_REGISTRY_ENDPOINT = "<registry>.azurecr.io"; azd ai rle publish --version-bump major
- name: run
description: Build and run the local RLE environment container.
usage: $env:AZD_AI_RLE_ENABLE = "true"; azd ai rle run
- name: invoke
description: Lease a deployed RLE sandbox and open an OpenEnv runtime shell.
usage: $env:AZD_AI_RLE_ENABLE = "true"; azd ai rle invoke
usage: $env:AZD_AI_RLE_ENABLE = "true"; $env:FOUNDRY_PROJECT_ENDPOINT = "https://<account>.services.ai.azure.com/api/projects/<project>"; azd ai rle invoke <environment-name> [--version <version>]
- name: list
description: List RLE environments in a Foundry project.
usage: $env:AZD_AI_RLE_ENABLE = "true"; $env:FOUNDRY_PROJECT_ENDPOINT = "https://<account>.services.ai.azure.com/api/projects/<project>"; azd ai rle list
- name: show
description: Show the details and version history for an RLE environment.
usage: $env:AZD_AI_RLE_ENABLE = "true"; $env:FOUNDRY_PROJECT_ENDPOINT = "https://<account>.services.ai.azure.com/api/projects/<project>"; azd ai rle show <environment-name>
4 changes: 2 additions & 2 deletions cli/azd/extensions/azure.ai.rle/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ module azure.ai.rle
go 1.26.4

require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.20.0
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1
github.com/azure/azure-dev/cli/azd v1.25.0
github.com/fatih/color v1.18.0
github.com/spf13/cobra v1.10.1
)

require (
github.com/AlecAivazis/survey/v2 v2.3.7 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.20.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault v1.5.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armsubscriptions v1.3.0 // indirect
Expand Down
Loading
Loading