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'
}
}