question

MathiasKvistAarup-3659 avatar image
0 Votes"
MathiasKvistAarup-3659 asked MichalZindulka-1503 edited

Working bicep example for Azure ML environments

Hi

I'm trying to deploy an environment and environment version to Azure ML using Bicep. The documentation doesn't have any examples, and I keep getting an unhelpful error stating:


"The response for resource had empty or invalid content."

Can anyone provide a working example deploying the following two resources:

Microsoft.MachineLearningServices/workspaces/environments@2021-03-01-preview
Microsoft.MachineLearningServices/workspaces/environments/versions@2021-03-01-preview

My config is like this and it can successfully deploy the cluster, but not the environment and version:

param location string = resourceGroup().location

resource amlCluster 'Microsoft.MachineLearningServices/workspaces/computes@2022-01-01-preview' = {
  name: 'workspaceA/cluster'
  location: location
  tags: {
    project: 'projectA'
  }
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    computeLocation: location
    computeType: 'AmlCompute'
    properties: {
      osType: 'Linux'
      vmSize: 'STANDARD_D1'
      scaleSettings: {
        minNodeCount: 0
        maxNodeCount: 2
      }
      subnet: null
    }
  }
}

// Create environment
resource amlEnv 'Microsoft.MachineLearningServices/workspaces/environments@2021-03-01-preview' = {
  name: 'workspaceA/env'
  properties: {
    properties: {}
    tags: {}
  }
  
}

resource amlEnvVersion 'Microsoft.MachineLearningServices/workspaces/environments/versions@2021-03-01-preview' = {
  name: 'env-version'
  parent: amlEnv
  properties: {
    properties: {}
    isAnonymous: false
    docker: {
        platform: {
            operatingSystemType: 'Linux'
        }
        dockerSpecificationType: 'Image'
        dockerImageUri: 'mcr.microsoft.com/azureml/base:intelmpi2018.3-ubuntu16.04'
    }
    condaFile: 'conda.yml'
  }
}

azure-machine-learning
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, thanks for reaching out. I have forwarded your feedback to the product team. Will get back to you shortly.

0 Votes 0 ·
MikeC-5683 avatar image
0 Votes"
MikeC-5683 answered

Check on this - https://medium.com/codex/using-bicep-to-create-workspace-resources-and-get-started-with-azure-machine-learning-bcc57fd4fd09

Azure create no bicep related, you need to search for external resource

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

MichalZindulka-1503 avatar image
0 Votes"
MichalZindulka-1503 answered MichalZindulka-1503 edited

Hi, I had the same issue. I could not create a custom environment and then a version as stated in the documentation and even when you export the ARM template from existing resources. Then by the 'try/fail' approach, I found that I don't need to create an 'environments' resource at all, only the 'environments/version' is enough, but need to specify the valid path in the 'name' property.

 param ml_workspace_name string = 'my-workspace'
 param ml_cust_env_name string = 'MY_CUSTOM_ENV'
 param ml_cust_env_version string = '1'
 param ml_cust_env_image string = 'myacr.azurecr.io/my-image:dev'
    
 resource ml_cust_env 'Microsoft.MachineLearningServices/workspaces/environments/versions@2022-05-01' = {
   name: '${ml_workspace_name}/${ml_cust_env_name}/${ml_cust_env_version}'
   properties: {
     image: ml_cust_env_image
     osType: 'Linux'
   }
 }
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.