I am currently trying to create consistent components tagging in Azure ML workspace. Instead of using the component name created by default, which can be hard to understand at times, I intend to use kebab-case
for naming the components.
I can create consistent naming through the UI (i.e. by clicking through multiple buttons each time). I would like to automate the tagging process using bash script, and I have written a simple bash script for this purpose.
#! /usr/bin/sh
# Define and label the resources
RESOURCE_GROUP="rg-test"
REGION="westeurope"
WORKSPACE_NAME="mlw-test"
# Create the resource group
echo "Create the resource group"
az group create --name $RESOURCE_GROUP --location $REGION
# Create Azure ML workspace
# az ml workspace create --name $WORKSPACE_NAME
While this bash script would work to create a functional workspace, but the name of other components created along with this workspace such as container-registry
, application-insights
are randomly assigned. Therefore, I studied the documentation a bit more to check how to configure the labels for these additional components, and I came across this docs to define the components naming.
Link: https://learn.microsoft.com/de-de/cli/azure/ml/workspace?view=azure-cli-latest
I modified the initial bash script to extend the naming to other components, and found out that creating a new name for each listed component does not seem to be possible, unless these components have been already created.
az ml workspace create --resourceGroupName $RESOURCE_GROUP --workspaceName $WORKSPACE_NAME --location $REGION --application-insights appi-test --container-registry crtest --key-vault kv-test --storage-account sttest
I also learned from the YAML syntax that creating a new name doesn't seem to be possible, unless the resources exist already:
The fully qualified resource ID of an existing Azure container registry to use as the default container registry for the workspace (https://learn.microsoft.com/en-us/azure/machine-learning/reference-yaml-workspace?view=azureml-api-2)
So, my question is that how can we create consistent naming for new components from the terminal without using Azure default random naming?
Thank you!
You can create consistent naming for new components by first creating the required resources (Application Insights, Container Registry, Key Vault, and Storage Account) with your desired names, and then referencing them when creating the Azure ML workspace.
Here's a modified version of your bash script that creates each resource with a consistent naming pattern and then creates the Azure ML workspace:
With the above command, I was able to create resources with consistent names.