Re

In today’s AI-driven world, building, training, deploying, and managing machine learning (ML) models efficiently is more critical than ever. Azure Machine Learning (Azure ML) is a cloud-based platform offered by Microsoft that empowers developers and data scientists to accelerate the ML lifecycle. From automated ML to large-scale training to responsible AI tools, Azure ML provides everything you need to build enterprise-grade machine learning solutions.
This guide provides a deep dive into Azure Machine Learning Service, with hands-on examples using both code (Python SDK) and Azure Machine Learning Studio (a visual drag-and-drop interface). Whether you’re an experienced data scientist or a developer exploring ML, this guide will help you understand how to harness Azure ML in real-world applications.
What is Azure Machine Learning Service?
Azure Machine Learning is a cloud-based platform that allows users to:
- Prepare data
- Build and train models
- Deploy models as web services
- Monitor and manage the deployed models
- Automate workflows using pipelines
It supports multiple tools and languages including Python, R, Jupyter Notebooks, and REST APIs. It integrates with popular ML libraries like TensorFlow, PyTorch, scikit-learn, and XGBoost.
Core Components of Azure Machine Learning
- Workspace — A centralized resource to manage all assets related to your ML projects.
- Compute — Enables on-demand scalable training using CPUs, GPUs, or clusters.
- Datasets — Reusable data references with versioning.
- Experiments — Logs all model training runs for comparison.
- Pipelines — Automates multi-step ML workflows.
- Endpoints — REST endpoints for deployed models.
- Model Registry — Stores and manages versioned models.
Use Case: Predicting House Prices with Azure Machine Learning
Let’s build and deploy a regression model that predicts housing prices using the famous California Housing dataset.
Part 1: Using Azure ML Python SDK
Step 1: Install Dependencies
Ensure the following Python packages are installed:
pip install azureml-core azureml-sdk azureml-dataset-runtime scikit-learn pandas
Step 2: Connect to Azure ML Workspace
from azureml.core import Workspace
ws = Workspace.from_config() # Reads config.json created from portal
print(ws.name, ws.location, ws.resource_group, sep='\n')
You can download the config.json from Azure Portal after creating your workspace.
Step 3: Prepare Data
import pandas as pd
from sklearn.datasets import fetch_california_housing
housing = fetch_california_housing(as_frame=True)
df = housing.frame
df.to_csv("housing.csv", index=False)
Step 4: Create an Experiment and Submit a Run
from azureml.core import Experiment, ScriptRunConfig, Environment, Dataset
experiment = Experiment(workspace=ws, name='housing-price-prediction')
# Upload data to datastore
ds = ws.get_default_datastore()
ds.upload(src_dir='.', target_path='data/', overwrite=True)
# Register dataset
dataset = Dataset.Tabular.from_delimited_files(path=[(ds, 'data/housing.csv')])
dataset = dataset.register(workspace=ws, name='Housing Dataset', create_new_version=True)
# Create training script
with open("train.py", "w") as f:
f.write("""
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
import joblib
df = pd.read_csv('housing.csv')
X = df.drop('MedHouseVal', axis=1)
y = df['MedHouseVal']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
model = LinearRegression()
model.fit(X_train, y_train)
joblib.dump(model, 'model.joblib')
""")
# Define environment
env = Environment.from_conda_specification(name="housing-env", file_path=None)
env.python.conda_dependencies.add_pip_package("scikit-learn")
env.python.conda_dependencies.add_pip_package("pandas")
# Configure and submit
src = ScriptRunConfig(source_directory='.', script='train.py', environment=env)
run = experiment.submit(config=src)
run.wait_for_completion(show_output=True)
Step 5: Register the Model
from azureml.core import Model
model = run.register_model(model_name='housing-price-model', model_path='model.joblib')
print(model.name, model.id, model.version, sep='\n')
Step 6: Deploy the Model
from azureml.core.webservice import AciWebservice
from azureml.core.model import InferenceConfig
# Create scoring script
with open("score.py", "w") as f:
f.write("""
import joblib
import json
import numpy as np
def init():
global model
model = joblib.load('model.joblib')
def run(data):
try:
inputs = json.loads(data)
data = np.array(inputs['data'])
result = model.predict(data).tolist()
return {'result': result}
except Exception as e:
return {'error': str(e)}
""")
# Inference config
inference_config = InferenceConfig(entry_script='score.py', environment=env)
# Deployment config
deployment_config = AciWebservice.deploy_configuration(cpu_cores=1, memory_gb=1)
# Deploy
service = Model.deploy(workspace=ws,
name='housing-price-service',
models=[model],
inference_config=inference_config,
deployment_config=deployment_config)
service.wait_for_deployment(show_output=True)
print(service.scoring_uri)
Step 7: Test the Deployed Model
import requests
import json
sample_data = json.dumps({"data": [[8.32, 41.0, 6.984127, 1.02381, 322.0, 2.555556, 37.88, -122.23]]})
headers = {'Content-Type': 'application/json'}
response = requests.post(service.scoring_uri, data=sample_data, headers=headers)
print("Prediction:", response.json())
Part 2: Using Azure Machine Learning Studio
Azure ML Studio (https://ml.azure.com/) provides a low-code/no-code interface to build, train, and deploy models. Here’s how to replicate the housing price prediction:
Step 1: Create a New Pipeline
- Navigate to Designer → Create new pipeline.
- Drag Dataset → Choose “From Open Datasets” → California Housing.
Step 2: Data Preprocessing
- Drag a Split Data module to split 80/20.
- Drag a Select Columns in Dataset to separate features and label.
Step 3: Train the Model
- Drag a Linear Regression model.
- Drag Train Model and connect data and model.
- Specify label column as
MedHouseVal.
Step 4: Evaluate the Model
- Use Score Model and Evaluate Model modules.
- Run the pipeline.
Step 5: Deploy the Model
- Select the Trained Model, click “Deploy”.
- Choose real-time endpoint and provide inference configuration.
Step 6: Test the Endpoint
- After deployment, test directly via Studio or get the scoring URI and use Python or Postman to call it.
Monitoring and Logging
Azure ML provides built-in monitoring:
- Runs tab for experiment metrics
- Endpoints tab for deployed model metrics
- Application Insights integration for real-time telemetry
You can also retrain models based on new data and update endpoints with newer versions using CI/CD pipelines via GitHub Actions or Azure DevOps.
Costs and Optimization Tips
- Use Azure ML Compute clusters with auto-scaling to save on compute cost.
- Prefer low priority VMs if job timing is not urgent.
- Clean up unused endpoints and experiments regularly.
Conclusion
Azure Machine Learning Service offers a powerful, flexible, and scalable platform for the entire ML lifecycle. Whether you prefer code-first workflows with Python SDK or visual drag-and-drop experiences with ML Studio, Azure ML enables you to go from idea to production effortlessly.
With features like model versioning, endpoints, AutoML, and integration with Azure DevOps, it’s ideal for both enterprise and startup ML initiatives.
If you’re building ML solutions on Azure, start with Azure Machine Learning — your all-in-one ML platform.
About the Author
ARINDAM DAS
Cloud Architect // Azure & GCP Expert // Turning Ideas into Scalable Cloud Solutions // Author & Problem-Solver
Das, A (2025). Getting Started with Azure Machine Learning Service: A Comprehensive Guide for Data Scientists and Developers. Available at: Getting Started with Azure Machine Learning Service: A Comprehensive Guide for Data Scientists and Developers | by Arindam Das | Jul, 2025 | Medium [Accessed: 7th August 2025].




