I create my Azure Machine Learning Workspace using Azure CLI:

$env="prd"$instance="001"$location="uksouth"$suffix="predict-$env-$location-$instance"$rg="rg-$suffix"$ws="mlw-$suffix"$computeinstance="vm-$suffix".Replace('-','')$computeinstanceaz group create --name $rg --location $locationaz configure --defaults group=$rgaz ml workspace create --name $wsaz configure --defaults workspace=$wsaz ml compute create --name $computeinstance --size Standard_DS11_v2 --type ComputeInstance

I run the above code manually in Visual Studio Code, and everything works properly.

However, when I integrate the above into an Azure DevOps pipeline via the YAML:

steps:- bash: az extension add -n mldisplayName: 'Install Azure ml extension'- task: AzureCLI@2inputs:azureSubscription: "$(AZURE_RM_SVC_CONNECTION)"scriptType: 'ps'scriptLocation: 'scriptPath'scriptPath: './environment_setup/aml-cli.ps1'
  • The pipeline creates the Azure Machine Learning workspace as expected.
  • The pipeline creates the compute instance, which has the status "Running" and green status.
  • However, the compute instance has all applications greyed out. This means I cannot connect to the compute instance using a terminal, notebook or otherwise, essentially making it useless. The application links in the following screenshot are not clickable:

enter image description here

I attempted:

  • Specifying brand new resource names.
  • Creating the workspace and compute in separate pipelines in case of a timing issue.
  • Deleting the resource group first using:
az group delete -n rg-predict-prd-uksouth-001 --force-deletion-types Microsoft.Compute/virtualMachines --yes

All to no avail.

How do I create a useable Azure Machine Learning compute instance using Azure CLI and Azure DevOps pipelines?

1

Best Answer


Earlier only the creator of the instance was allowed to run the jupyter,jupyterlab etc(check the comments on this issue) but now there is a feature in preview that allows to create a compute instance "on behalf of" someone.

enter image description here

So please try passing the aad user's objectid who will access the compute instance's development tools. The same can be done using arm templates also using 'personalComputeInstanceSettings' property.

az ml compute create --name $computeinstance --size Standard_DS11_v2--type ComputeInstance --user-object-id <aaduserobjectid> --user-tenant-id <aaduserobjecttenantid>

enter image description here