If you find this project helpful, please consider giving ZenML a star on GitHub. Your support helps promote the project and lets others know it's worth checking out.
Thank you for your support! 🌟
This Terraform module sets up the necessary Azure cloud infrastructure for a ZenML stack. It provisions various Azure services and resources, and registers a ZenML stack using these resources with your ZenML server, allowing you to create an internal MLOps platform for your entire machine learning team.
- Terraform installed (version >= 1.9")
- Azure account set up
- To authenticate with Azure, you need to have the Azure CLI
installed on your machine and you need to have run
az login
to set up your credentials. - You'll need a Zenml server (version >= 0.62.0) deployed in a remote setting where it can be accessed from Azure. You have the option to either self-host a ZenML server or register for a free ZenML Pro account. Once you have a ZenML Server set up, you also need to create a ZenML Service Account API key for your ZenML Server. You can do this by running the following command in a terminal where you have the ZenML CLI installed:
zenml service-account create <service-account-name>
- This Terraform module uses the ZenML Terraform provider. It is recommended to use environment variables to configure the ZenML Terraform provider with the API key and server URL. You can set the environment variables as follows:
export ZENML_SERVER_URL="https://your-zenml-server.com"
export ZENML_API_KEY="your-api-key"
The Terraform module in this repository creates the following resources in your Azure subscription:
- an Azure Resource Group with the following child resources:
a. an Azure Storage Account and a Blob Container
b. an Azure Container Registry
c. an AzureML Workspace with additional required child resources:
- a Key Vault instance
- an Application Insights instance
- an Azure Service Principal with a Service Principal Password and the minimum necessary permissions to access the Blob Container, the ACR container registry, the AzureML Workspace and the Azure subscription to build and push container images, store artifacts and run pipelines.
The Terraform module automatically registers a fully functional Azure ZenML stack directly with your ZenML server. The ZenML stack is based on the provisioned Azure resources and permissions and is ready to be used to run machine learning pipelines.
The ZenML stack configuration is the following:
- an Azure Artifact Store linked to the Azure Storage Account and Blob Container via an Azure Service Connector configured with the Azure Service Principal credentials
- an ACR Container Registry linked to the Azure Container Registry via an Azure Service Connector configured with the Azure Service Principal credentials
- depending on the
orchestrator
input variable:
- if
orchestrator
is set tolocal
: a local Orchestrator. This can be used in combination with the AzureML Step Operator to selectively run some steps locally and some on AzureML. - if
orchestrator
is set toskypilot
(default): an Azure SkyPilot Orchestrator linked to the Azure subscription via an Azure Service Connector configured with the Azure Service Principal credentials - if
orchestrator
is set toazureml
: an AzureML Orchestrator linked to the AzureML Workspace via an Azure Service Connector configured with the Azure Service Principal credentials
- an AzureML Step Operator linked to the AzureML Workspace via an Azure Service Connector configured with the Azure Service Principal credentials
To use the ZenML stack, you will need to install the required integrations:
- for AzureML:
zenml integration install azure
- for SkyPilot:
zenml integration install azure skypilot_azure
To use this module, aside from the prerequisites mentioned above, you also need to create a ZenML Service Account API key for your ZenML Server. You can do this by running the following command in a terminal where you have the ZenML CLI installed:
zenml service-account create <service-account-name>
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
}
azuread = {
source = "hashicorp/azuread"
}
zenml = {
source = "zenml-io/zenml"
}
}
}
provider "azurerm" {
features {
resource_group {
prevent_deletion_if_contains_resources = false
}
}
}
provider "zenml" {
# server_url = <taken from the ZENML_SERVER_URL environment variable if not set here>
# api_key = <taken from the ZENML_API_KEY environment variable if not set here>
}
module "zenml_stack" {
source = "zenml-io/zenml-stack/azure"
location = "westus"
orchestrator = "azureml" # or "skypilot" or "local"
zenml_stack_name = "my-zenml-stack"
}
output "zenml_stack_id" {
value = module.zenml_stack.zenml_stack.id
}
output "zenml_stack_name" {
value = module.zenml_stack.zenml_stack.name
}
ZenML Documentation ZenML Starter Guide ZenML Examples ZenML Blog
If you need assistance, join our Slack community or open an issue on our GitHub repo.
Features · Roadmap · Report Bug · Sign up for ZenML Pro · Read Blog · Contribute to Open Source · Projects Showcase