Preparing a Compute Environment for the Pipeline
Start course
1h 23m

Learn how to operate machine learning solutions at cloud scale using the Azure Machine Learning SDK. This course teaches you to leverage your existing knowledge of Python and machine learning to manage data ingestion, data preparation, model training, and model deployment in Microsoft Azure.

If you have any feedback related to this course, please contact us at

Learning Objectives

  • Create an Azure Machine Learning workspace using the SDK
  • Run experiments and train models using the SDK
  • Optimize and manage models using the SDK
  • Deploy and consume models using the SDK

Intended Audience

This course is designed for data scientists with existing knowledge of Python and machine learning frameworks, such as Scikit-Learn, PyTorch, and Tensorflow, who want to build and operate machine learning solutions in the cloud.


  • Fundamental knowledge of Microsoft Azure
  • Experience writing Python code to work with data using libraries such as Numpy, Pandas, and Matplotlib
  • Understanding of data science, including how to prepare data and train machine learning models using common machine learning libraries, such as Scikit-Learn, PyTorch, or Tensorflow


The GitHub repo for this course, containing the code and datasets used, can be found here: 


The pipeline will eventually be published and run on demand. So it needs a computer environment in which to run. In the filling and walkthrough, we will use the same computer the both steps, but it's important to realize that each step is run independently. So you could specify different compute contexts for each step, if appropriate.

First, we need a compute target. And for this walkthrough will create an Azure learning compute cluster in our workspace. The pipeline will eventually be published and run on demand. So it needs a computer environment in which to run. With the following and work through, we'll use the same compute for both steps. But it's just important to realize that each step is running independently, so we could specify different compete context for each step if appropriate. So we will need a compute target.

In this case, we use same Azure machine learning compute cluster in our workspace. So let's import compute target, Azure machine learning compute. We'll also import computer target exception. The cluster name is QA Azure ML, ACK. We've verified that the cluster that exists. If it's found, we use it, if not, we create it.

So we specify the compute configuration, where you seeing the standard D2, V2 for VM size, maximum nodes four and an idle seconds before scale down is 1800. We then pass on the compute config to a compute target, create function, we'll also pass in the workspace details as well, as well as the cluster name to create our compute target. The computer will require a path in environment with a necessary packet dependencies installed. So we will create a run configuration.

So we start by getting our environment class imported. Core independencies will also need to import run configuration. We then create a Python environment for the experiment. We specify the environment name. We allow Azure ML to manage dependencies. We also ensure that Docker is enabled so we can use a container, Docker container. We then create a set of package dependencies.

So we've got Scikit learn, Pandas, and then with PIP packages, we use an Azure AML, SDK. We add the dependencies to the environment, and then we register the environment. So just in case we want to use it again, we create a run config for the pipeline, and then we use the compute we created above, and then we assign the environment to the running configuration.

About the Author

Kofi is a digital technology specialist in a variety of business applications. He stays up to date on business trends and technology and is an early adopter of powerful and creative ideas.
His experience covers a wide range of topics including data science, machine learning, deep learning, reinforcement learning, DevOps, software engineering, cloud computing, business & technology strategy, design & delivery of flipped/social learning experiences, blended learning curriculum design and delivery, and training consultancy.