Reader small image

You're reading from  Machine Learning Security with Azure

Product typeBook
Published inDec 2023
PublisherPackt
ISBN-139781805120483
Edition1st Edition
Tools
Right arrow
Author (1)
Georgia Kalyva
Georgia Kalyva
author image
Georgia Kalyva

Georgia Kalyva is a technical trainer at Microsoft. She was recognized as a Microsoft AI MVP, is a Microsoft Certified Trainer, and is an international speaker with more than 10 years of experience in Microsoft Cloud, AI, and developer technologies. Her career covers several areas, ranging from designing and implementing solutions to business and digital transformation. She holds a bachelor's degree in informatics from the University of Piraeus, a master's degree in business administration from the University of Derby, and multiple Microsoft certifications. Georgia's honors include several awards from international technology and business competitions, and her journey to excellence stems from a growth mindset and a passion for technology.
Read more about Georgia Kalyva

Right arrow

Managing and Securing the MLOps Life Cycle

As important as data and infrastructure are, their management can create overhead and take away from the actual ML tasks. When different roles collaborate on an ML project, there is a need to automate and standardize things to make the daily tasks more efficient.

In this chapter, we will explore MLOps best practices and how we can implement them using Azure and other tools. We will dive into how to leverage Infrastructure as Code (IaC) and some applications of DevOps in the ML life cycle for continuous integration/continuous delivery (CI/CD) using Azure DevOps. These are not the only ways to implement MLOps, though. Azure provides us with comprehensive monitoring and logging capabilities, which we can leverage with services such as Event Grid and others to initiate event-driven workflows. This means we are not limited to tools but we can implement our own workflows and easily tailor them to our own processes.

In this chapter, we’...

Technical requirements

This chapter delves into several DevOps concepts. Some experience with Git, version control, and DevOps will be useful to understand the concepts described in this chapter. If you lack knowledge of the preceding technologies, the following learning resources will help you understand some basic concepts and functions. Go through them to review the prerequisites needed to understand the content of this chapter:

Working with MLOps in Azure Machine Learning

The term MLOps is a combination of Machine Learning and Operations and refers to the practices, tools, and strategies for the life cycle management of ML models in a production environment. Just as DevOps aims to streamline the development and operations processes for software, MLOps aims to do the same for ML systems. Implementing MLOps can improve productivity, reproducibility, and agility in ML projects. MLOps focuses on a specific set of practices.

Let us explore each practice and how we can use Azure Machine Learning features for each one:

  • Collaboration: Facilitating effective collaboration between various roles such as data scientists, ML engineers, and operations teams is core in ML projects as there are multiple roles involved in the success of the project. By using shared platforms and tools, a data scientist focuses on model prototyping, an ML engineer ensures it’s production-ready, and an operations specialist...

Leveraging IaC

IaC is a key practice in DevOps that enables developers and operations to automatically manage, provision, and configure IT infrastructure through code. In Azure, there are a variety of tools and services that facilitate IaC practices. We have already mentioned some of these previously but we will review everything here.

Let us delve into how IaC is implemented in Azure and the services we can use:

  • Azure Resource Manager (ARM) templates: ARM templates are the native IaC solution in Azure. They are JSON files that define the resources you need to deploy for your solution. By using ARM templates, you can define and deploy your infrastructure declaratively. We can make them more modular by defining parameters for our templates to create reusable deployment scripts and implement conditional logic for resource deployment.
  • Azure Bicep: Bicep is a language for deploying Azure resources declaratively. It’s essentially a transparent abstraction over ARM...

Implementing CI/CD

CI/CD is a software engineering practice that promotes frequent code integration and automated deployment. This approach is becoming increasingly popular in ML projects to ensure models are constantly improved, validated, and deployed in a streamlined manner. In Azure Machine Learning, there are multiple tools and services to help you implement CI/CD in your ML life cycle.

Here’s an example of CI/CD:

  1. By using VS Code with Azure Machine Learning extensions for development, we can develop our scripts.
  2. Those scripts can be version-controlled using Git repositories (such as GitHub or Azure Repos).
  3. If we have the expertise, we can set up automated testing to validate our models. This might include unit tests, integration tests, and other validation or data checks.
  4. We can configure Azure Pipelines to automatically trigger when changes are made to the repository. A CI/CD pipeline could include the following:
    • Training the model
    • Logging metrics...

Exploring event-driven workflows in Azure

In the context of Microsoft Azure, the term event can be associated with several services and concepts, but most commonly, it refers to a message or notification that indicates the occurrence of something on the platform. For example, every action we complete in the workspace generates events, such as when the workspace was created or when we changed settings. These events can be leveraged by other services such as Azure Event Grid to create workflows triggered by the event. Let us check it next.

Exploring Event Grid

Azure Event Grid is a fully managed event routing service. It enables you to easily build applications that react to changes or events happening within Azure services or even on-premises. Azure Event Grid is designed to connect different parts of a cloud-based application together through events. Applications can greatly benefit from Azure Event Grid in various scenarios, such as automating workflows in response to events...

Summary

In this chapter, we saw a brief explanation of MLOps and how valuable it is in ML projects. By using MLOps tools and best practices, we can streamline our ML tasks to facilitate efficiency and collaboration.

Although MLOps has tools and practices that range from data, models, deployments, and development, we focused more on how we can use IaC to handle our resources, and how to implement CI/CD using DevOps. Although using established code development tools offers the most common ways of working, when it comes to Azure, they are not the only ones. As Azure collects several logs and events in its services, we can leverage those to automate and create our own custom workflows using other Azure services and tools. The logs that Azure collects about its services can be used for more than telemetry and reporting.

Let us move on to the next chapter now, in which we will see how we can use the Azure Monitor service for logging, monitoring, and threat detection.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Machine Learning Security with Azure
Published in: Dec 2023Publisher: PacktISBN-13: 9781805120483
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Georgia Kalyva

Georgia Kalyva is a technical trainer at Microsoft. She was recognized as a Microsoft AI MVP, is a Microsoft Certified Trainer, and is an international speaker with more than 10 years of experience in Microsoft Cloud, AI, and developer technologies. Her career covers several areas, ranging from designing and implementing solutions to business and digital transformation. She holds a bachelor's degree in informatics from the University of Piraeus, a master's degree in business administration from the University of Derby, and multiple Microsoft certifications. Georgia's honors include several awards from international technology and business competitions, and her journey to excellence stems from a growth mindset and a passion for technology.
Read more about Georgia Kalyva