Azure Machine Learning Documentation

How to create an Azure Machine Learning workspace

This guide walks you through creating an Azure Machine Learning (AML) workspace using the Azure portal, Azure CLI, PowerShell, and Python SDK.

Prerequisites

1. Create via Azure portal

  1. Sign in to the Azure portal.
  2. Search for Machine Learning and click Create.
  3. Fill in the required fields:
    • Subscription
    • Resource group (or create a new one)
    • Workspace name
    • Region
    • Optional: Customer-managed key
  4. Click Review + create, then Create.
  5. Wait for deployment to complete. The workspace appears in the resource list.

2. Create via Azure CLI

# Set variables
RESOURCE_GROUP=myResourceGroup
WORKSPACE_NAME=myMLWorkspace
LOCATION=eastus

# Create resource group (if needed)
az group create --name $RESOURCE_GROUP --location $LOCATION

# Create the workspace
az ml workspace create \
  --name $WORKSPACE_NAME \
  --resource-group $RESOURCE_GROUP \
  --location $LOCATION

3. Create via PowerShell

# Variables
$resourceGroup = "myResourceGroup"
$workspaceName = "myMLWorkspace"
$location = "EastUS"

# Create resource group (if not existent)
New-AzResourceGroup -Name $resourceGroup -Location $location

# Create AML workspace
New-AzMLWorkspace -Name $workspaceName `
                 -ResourceGroupName $resourceGroup `
                 -Location $location

4. Create via Python SDK

from azure.identity import DefaultAzureCredential
from azure.ai.ml import MLClient

# Authenticate
credential = DefaultAzureCredential()
subscription_id = "YOUR_SUBSCRIPTION_ID"
resource_group = "myResourceGroup"
workspace_name = "myMLWorkspace"

# Initialize client
ml_client = MLClient(credential, subscription_id, resource_group, workspace_name)

# Create workspace (idempotent)
ml_client.workspaces.create_or_update(
    name=workspace_name,
    location="eastus",
    description="My first AML workspace"
)
print(f"Workspace '{workspace_name}' created.")

Next steps