Search code examples
azureterraformazure-machine-learning-service

How to create Azure ML Registry using Terraform?


How do I create Azure ML registry using terraform? I see we have a way to create Azure ML workspace (azurerm_machine_learning_workspace) and ACR as well. But I don't see a way to explicitly create ML registry or am I something? Can someone help me with it please?


Solution

  • Creating Azure ML Registry using Terraform

    On checking with recent most doc from harshicrop the azure machine learning registry is missing from the provider.

    In order to achieve your requirement we need to use null resource where we can pass the CLI commands using terraform.

    As per the MSDoc we can create the registry for ml using the commands in null resource using terraform

    Configuration:

    provider "azurerm" {
      features {}
    }
    
    resource "null_resource" "create_ml_registry" {
      provisioner "local-exec" {
        command = <<EOT
          az ml registry create --resource-group ${azurerm_resource_group.rg.name} --file "${path.module}/registry.yml"
        EOT
        interpreter = ["pwsh", "-Command"]
      }
    }
    

    Deployment:

    enter image description here

    enter image description here