Azure Machine Learning workspace assets and compute
MLOps starts with reusable, versioned building blocks. The exam asks which asset or compute type fits a requirement, so learn what each one is for.
Core workspace assets
| Asset | What it holds | Key point |
|---|---|---|
| Environment | Docker image plus conda/pip dependencies | Versioned; a change means a new version |
| Data asset | Pointer to data (uri_file, uri_folder, mltable) | Data stays in storage; only the reference is versioned |
| Model | Registered artifacts, often in MLflow format | Register to version and deploy |
| Component | Reusable pipeline step | Share through a registry |
Every asset has a name and a version. Assets are not edited in place; you create a new version.
Environments
Three ways to define one: a curated environment, an existing Docker image, or a Docker build context. With SDK v2:
from azure.ai.ml.entities import Environment
env = Environment(
name="train-env",
image="mcr.microsoft.com/azureml/openmpi4.1.2-ubuntu20.04",
conda_file="conda.yml",
)
ml_client.environments.create_or_update(env)
Use image for a ready image, build for a Dockerfile folder, and conda_file to layer packages.
Data assets
A data asset type tells jobs how to read the data.
uri_file: one file.uri_folder: a folder, for example all blobs in a container.mltable: tabular data with a schema. In a notebook, load it withmltable.load()and thento_pandas_dataframe().
Paths can use azureml://datastores/... or https:// URIs.
Compute targets
| Target | Use it for |
|---|---|
| Compute instance | One data scientist, notebooks, interactive work |
| Compute cluster | Training jobs, scale to zero, low-priority VMs |
| Serverless compute | Jobs without managing a cluster |
| Kubernetes (AKS or Arc) | Real-time inference on your own cluster |
| Managed online endpoint | Fully managed real-time inference |
Registries and model lifecycle
An Azure Machine Learning registry is a central place to share models, environments, components and data across workspaces and regions. To retire a model version that must stay available for compliance or rollback, archive it; deleting removes it.
In notebooks, use %pip install so packages go into the running kernel only. !pip can install into a different environment.
Exam traps
- Editing an environment: you cannot; create a new version.
- Compute instance versus compute cluster: instance is single-user dev, cluster is for scalable training.
- Archive versus delete: archive keeps the model for audit and rollback.
- Git sync across workspaces is not asset sharing; a registry is.
!pipversus%pip: only%piptargets the current kernel.
Practice questions
Choose an answer, then review the explanation to check your understanding.
1. You define an Azure Machine Learning environment with the Python SDK v2 from a Docker image that already exists in a registry. Which parameter do you set?
Show answer
Answer: B.The image parameter points to an existing Docker image. build is for a Docker build context, and conda_file adds conda dependencies on top of a base image.
2. A new version of a Docker image is available and the environment must use it. What should you do?
Show answer
Answer: B.Environments are versioned and immutable. Register a new version with create_or_update instead of editing the old one.
3. Models, components and environments must be reused across several workspaces without copying them, with central governance. What do you use?
Show answer
Answer: B.An Azure Machine Learning registry publishes assets once so many workspaces can consume them.
4. Which compute target gives you low-priority (discounted) VMs for training and can scale to zero when idle?
Show answer
Answer: B.A compute cluster scales between min and max nodes and supports low-priority (Spot) VMs. A compute instance is a single-user dev machine.