Get started with Azure Machine Learning

Overview

Azure Machine Learning is a cloud‑based service for building, training, and deploying machine‑learning models at scale. This guide walks you through the initial steps to start creating intelligent solutions.

Read full overview

Prerequisites

Install the required SDKs:

pip install azure-ai-ml[notebooks] --upgrade

Quickstart: Build and deploy a model

  1. Set up your workspace
az login
az ml workspace create -w my-ml-workspace -g my-resource-group
  1. Prepare a training script
# train.py
from azure.ai.ml import MLClient
from azure.identity import DefaultAzureCredential

def main():
    # Dummy training code
    print("Training complete!")

if __name__ == "__main__":
    main()
  1. Submit the training job
az ml job create --file job.yml

Example job.yml:

name: iris-classifier
experiment_name: quickstart
environment: azureml:Python3.8-ubuntu20.04
code: .
command: >-
  python train.py
compute: azureml:cpu-cluster
distribution:
  type: tensorflow
  1. Deploy the model as a real‑time endpoint
az ml online-endpoint create -n iris-endpoint -f endpoint.yml
az ml online-deployment create -n default -e iris-endpoint -f deployment.yml

After deployment, you can invoke the endpoint:

curl -X POST -H "Content-Type: application/json" \
  -d '{"data": [[5.1, 3.5, 1.4, 0.2]]}' \
  https://.azurewebsites.net/score

Next steps