From e31769b41fc513987942acc3ba99f8180bfb9f36 Mon Sep 17 00:00:00 2001 From: Victor Barreto Date: Tue, 7 Jul 2026 14:43:54 +0100 Subject: [PATCH 1/2] Refactor setup script to enhance structure and add interactive menu for Azure ML setup --- infra/setup1.sh | 276 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 242 insertions(+), 34 deletions(-) diff --git a/infra/setup1.sh b/infra/setup1.sh index 030014f..2f317b8 100644 --- a/infra/setup1.sh +++ b/infra/setup1.sh @@ -1,48 +1,256 @@ -#! /usr/bin/sh +#!/usr/bin/env bash -# Check if a suffix was passed as an argument -if [[ -n "$1" ]]; then - suffix=$1 +set -u + +# Change the values of these variables as needed. +# You can also pass a suffix as the first argument when starting the script. + +DEFAULT_LOCATION="" +RESOURCE_PROVIDER="Microsoft.MachineLearningServices" +REGIONS=("eastus" "westus" "centralus" "northeurope" "westeurope") +COMPUTE_CLUSTER="aml-cluster" +COMPUTE_SIZE="STANDARD_DS11_V2" +MAX_RETRIES=3 +RETRY_DELAY=5 + +# ============================================================================ +# DON'T CHANGE ANYTHING BELOW THIS LINE. +# ============================================================================ + +generate_suffix() { + if command -v uuidgen >/dev/null 2>&1; then + uuidgen | tr '[:upper:]' '[:lower:]' | tr -d '-' | cut -c1-18 + else + printf '%(%s)T\n' -1 | tr -d '\n' | cut -c1-18 + fi +} + +if [[ -n "${1:-}" ]]; then + suffix=$(echo "$1" | tr '[:upper:]' '[:lower:]' | tr -cd 'a-z0-9' | cut -c1-18) else - # Generate random suffix from UUID if none was provided - guid=$(cat /proc/sys/kernel/random/uuid) - suffix=${guid//[-]/} - suffix=${suffix:0:18} + suffix=$(generate_suffix) fi -echo "Suffix: $suffix" +if [[ -z "$suffix" ]]; then + echo "Error: A valid suffix could not be determined." + exit 1 +fi + +if [[ -n "$DEFAULT_LOCATION" ]]; then + RANDOM_REGION="$DEFAULT_LOCATION" +else + RANDOM_REGION=${REGIONS[$RANDOM % ${#REGIONS[@]}]} +fi -# Set the necessary variables RESOURCE_GROUP="rg-ai300-l${suffix}" -RESOURCE_PROVIDER="Microsoft.MachineLearningServices" -REGIONS=("eastus" "westus" "centralus" "northeurope" "westeurope") -RANDOM_REGION=${REGIONS[$RANDOM % ${#REGIONS[@]}]} WORKSPACE_NAME="mlw-ai300-l${suffix}" COMPUTE_INSTANCE="ci${suffix}" -COMPUTE_CLUSTER="aml-cluster" -# Register the Azure Machine Learning resource provider in the subscription -echo "Register the Machine Learning resource provider:" -az provider register --namespace $RESOURCE_PROVIDER +run_az_command() { + local description="$1" + shift + + local attempt=1 + local exit_code=0 + + while (( attempt <= MAX_RETRIES )); do + echo "$description" + "$@" + exit_code=$? + + if [[ $exit_code -eq 0 ]]; then + return 0 + fi + + echo "Warning: command failed (attempt ${attempt}/${MAX_RETRIES})." + + if (( attempt == MAX_RETRIES )); then + echo "Error: unable to complete operation after ${MAX_RETRIES} attempts." + return $exit_code + fi + + echo "Retrying in ${RETRY_DELAY} seconds..." + sleep "$RETRY_DELAY" + attempt=$((attempt + 1)) + done + + return $exit_code +} + +require_command() { + if ! command -v "$1" >/dev/null 2>&1; then + echo "Error: Required command '$1' is not installed or not in PATH." + return 1 + fi +} + +check_prerequisites() { + echo "Checking prerequisites..." + + require_command az || return 1 + + if ! az account show >/dev/null 2>&1; then + echo "Error: Not authenticated with Azure. Please run: az login" + return 1 + fi + + echo "✓ Azure CLI is available and authenticated" +} + +register_resource_provider() { + run_az_command \ + "Register the Machine Learning resource provider:" \ + az provider register --namespace "$RESOURCE_PROVIDER" +} + +create_resource_group() { + run_az_command \ + "Create a resource group and set as default:" \ + az group create --name "$RESOURCE_GROUP" --location "$RANDOM_REGION" || return 1 + + run_az_command \ + "Set the default resource group:" \ + az configure --defaults group="$RESOURCE_GROUP" +} + +create_workspace() { + run_az_command \ + "Create an Azure Machine Learning workspace:" \ + az ml workspace create --name "$WORKSPACE_NAME" || return 1 + + run_az_command \ + "Set the default Azure Machine Learning workspace:" \ + az configure --defaults workspace="$WORKSPACE_NAME" +} + +create_compute_instance() { + run_az_command \ + "Creating a compute instance with name: $COMPUTE_INSTANCE" \ + az ml compute create --name "$COMPUTE_INSTANCE" --size "$COMPUTE_SIZE" --type ComputeInstance +} + +create_compute_cluster() { + run_az_command \ + "Creating a compute cluster with name: $COMPUTE_CLUSTER" \ + az ml compute create --name "$COMPUTE_CLUSTER" --size "$COMPUTE_SIZE" --max-instances 2 --type AmlCompute +} + +create_data_assets() { + run_az_command \ + "Create training data asset (MLTable):" \ + az ml data create --type mltable --name "diabetes-training" --path ../data/diabetes-data || return 1 + + run_az_command \ + "Create training data asset (CSV):" \ + az ml data create --type uri_file --name "diabetes-data" --path ../data/diabetes-data/diabetes.csv +} + +run_full_setup() { + check_prerequisites || return 1 + register_resource_provider || return 1 + create_resource_group || return 1 + create_workspace || return 1 + create_compute_instance || return 1 + create_compute_cluster || return 1 + create_data_assets || return 1 + + echo "" + echo "Setup complete." +} -# Create the resource group and workspace and set to default -echo "Create a resource group and set as default:" -az group create --name $RESOURCE_GROUP --location $RANDOM_REGION -az configure --defaults group=$RESOURCE_GROUP +show_status() { + echo "Current configuration" + echo "=====================================================================" + echo "Suffix: $suffix" + echo "Resource Group: $RESOURCE_GROUP" + echo "Location: $RANDOM_REGION" + echo "Workspace: $WORKSPACE_NAME" + echo "Compute Instance: $COMPUTE_INSTANCE" + echo "Compute Cluster: $COMPUTE_CLUSTER" + echo "=====================================================================" + echo "Suggested order: 1 -> 2 -> 3 -> 4 -> 5, or use option 6." +} -echo "Create an Azure Machine Learning workspace:" -az ml workspace create --name $WORKSPACE_NAME -az configure --defaults workspace=$WORKSPACE_NAME +show_menu() { + clear + echo "=====================================================================" + echo " Azure Machine Learning Lab Setup Menu" + echo "=====================================================================" + echo "Suffix: $suffix" + echo "Resource Group: $RESOURCE_GROUP" + echo "Location: $RANDOM_REGION" + echo "Workspace: $WORKSPACE_NAME" + echo "=====================================================================" + echo "1. Register Machine Learning resource provider" + echo "2. Create resource group and set defaults" + echo "3. Create Azure Machine Learning workspace" + echo "4. Create compute resources" + echo "5. Create data assets" + echo "6. Run full setup" + echo "7. Show configuration" + echo "8. Exit" + echo "=====================================================================" +} -# Create compute instance -echo "Creating a compute instance with name: " $COMPUTE_INSTANCE -az ml compute create --name ${COMPUTE_INSTANCE} --size STANDARD_DS11_V2 --type ComputeInstance +while true; do + show_menu + read -r -p "Please select an option (1-8): " choice -# Create compute cluster -echo "Creating a compute cluster with name: " $COMPUTE_CLUSTER -az ml compute create --name ${COMPUTE_CLUSTER} --size STANDARD_DS11_V2 --max-instances 2 --type AmlCompute + case "$choice" in + 1) + echo "" + check_prerequisites && register_resource_provider + echo "" + read -r -p "Press Enter to continue..." + ;; + 2) + echo "" + check_prerequisites && create_resource_group + echo "" + read -r -p "Press Enter to continue..." + ;; + 3) + echo "" + check_prerequisites && create_workspace + echo "" + read -r -p "Press Enter to continue..." + ;; + 4) + echo "" + check_prerequisites && create_compute_instance && create_compute_cluster + echo "" + read -r -p "Press Enter to continue..." + ;; + 5) + echo "" + check_prerequisites && create_data_assets + echo "" + read -r -p "Press Enter to continue..." + ;; + 6) + echo "" + run_full_setup + echo "" + read -r -p "Press Enter to continue..." + ;; + 7) + echo "" + show_status + echo "" + read -r -p "Press Enter to continue..." + ;; + 8) + echo "Exiting..." + clear + exit 0 + ;; + *) + echo "" + echo "Invalid option. Please select 1-8." + echo "" + read -r -p "Press Enter to continue..." + ;; + esac -# Create data assets -echo "Create training data asset:" -az ml data create --type mltable --name "diabetes-training" --path ../data/diabetes-data -az ml data create --type uri_file --name "diabetes-data" --path ../data/diabetes-data/diabetes.csv + echo "" +done From 21d7803c076b7943125eb9d5ac4b4e4a2936d031 Mon Sep 17 00:00:00 2001 From: Victor Barreto Date: Thu, 9 Jul 2026 16:05:45 +0100 Subject: [PATCH 2/2] Refactor setup scripts for improved structure and functionality --- infra/setup1.sh | 276 ++++++------------------------------------------ infra/setup2.sh | 256 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 290 insertions(+), 242 deletions(-) create mode 100644 infra/setup2.sh diff --git a/infra/setup1.sh b/infra/setup1.sh index 2f317b8..d16540a 100644 --- a/infra/setup1.sh +++ b/infra/setup1.sh @@ -1,256 +1,48 @@ -#!/usr/bin/env bash +#! /usr/bin/sh -set -u - -# Change the values of these variables as needed. -# You can also pass a suffix as the first argument when starting the script. - -DEFAULT_LOCATION="" -RESOURCE_PROVIDER="Microsoft.MachineLearningServices" -REGIONS=("eastus" "westus" "centralus" "northeurope" "westeurope") -COMPUTE_CLUSTER="aml-cluster" -COMPUTE_SIZE="STANDARD_DS11_V2" -MAX_RETRIES=3 -RETRY_DELAY=5 - -# ============================================================================ -# DON'T CHANGE ANYTHING BELOW THIS LINE. -# ============================================================================ - -generate_suffix() { - if command -v uuidgen >/dev/null 2>&1; then - uuidgen | tr '[:upper:]' '[:lower:]' | tr -d '-' | cut -c1-18 - else - printf '%(%s)T\n' -1 | tr -d '\n' | cut -c1-18 - fi -} - -if [[ -n "${1:-}" ]]; then - suffix=$(echo "$1" | tr '[:upper:]' '[:lower:]' | tr -cd 'a-z0-9' | cut -c1-18) +# Check if a suffix was passed as an argument +if [[ -n "$1" ]]; then + suffix=$1 else - suffix=$(generate_suffix) + # Generate random suffix from UUID if none was provided + guid=$(cat /proc/sys/kernel/random/uuid) + suffix=${guid//[-]/} + suffix=${suffix:0:18} fi -if [[ -z "$suffix" ]]; then - echo "Error: A valid suffix could not be determined." - exit 1 -fi - -if [[ -n "$DEFAULT_LOCATION" ]]; then - RANDOM_REGION="$DEFAULT_LOCATION" -else - RANDOM_REGION=${REGIONS[$RANDOM % ${#REGIONS[@]}]} -fi +echo "Suffix: $suffix" +# Set the necessary variables RESOURCE_GROUP="rg-ai300-l${suffix}" +RESOURCE_PROVIDER="Microsoft.MachineLearningServices" +REGIONS=("eastus" "westus" "centralus" "northeurope" "westeurope") +RANDOM_REGION=${REGIONS[$RANDOM % ${#REGIONS[@]}]} WORKSPACE_NAME="mlw-ai300-l${suffix}" COMPUTE_INSTANCE="ci${suffix}" +COMPUTE_CLUSTER="aml-cluster" -run_az_command() { - local description="$1" - shift - - local attempt=1 - local exit_code=0 - - while (( attempt <= MAX_RETRIES )); do - echo "$description" - "$@" - exit_code=$? - - if [[ $exit_code -eq 0 ]]; then - return 0 - fi - - echo "Warning: command failed (attempt ${attempt}/${MAX_RETRIES})." - - if (( attempt == MAX_RETRIES )); then - echo "Error: unable to complete operation after ${MAX_RETRIES} attempts." - return $exit_code - fi - - echo "Retrying in ${RETRY_DELAY} seconds..." - sleep "$RETRY_DELAY" - attempt=$((attempt + 1)) - done - - return $exit_code -} - -require_command() { - if ! command -v "$1" >/dev/null 2>&1; then - echo "Error: Required command '$1' is not installed or not in PATH." - return 1 - fi -} - -check_prerequisites() { - echo "Checking prerequisites..." - - require_command az || return 1 - - if ! az account show >/dev/null 2>&1; then - echo "Error: Not authenticated with Azure. Please run: az login" - return 1 - fi - - echo "✓ Azure CLI is available and authenticated" -} - -register_resource_provider() { - run_az_command \ - "Register the Machine Learning resource provider:" \ - az provider register --namespace "$RESOURCE_PROVIDER" -} - -create_resource_group() { - run_az_command \ - "Create a resource group and set as default:" \ - az group create --name "$RESOURCE_GROUP" --location "$RANDOM_REGION" || return 1 - - run_az_command \ - "Set the default resource group:" \ - az configure --defaults group="$RESOURCE_GROUP" -} - -create_workspace() { - run_az_command \ - "Create an Azure Machine Learning workspace:" \ - az ml workspace create --name "$WORKSPACE_NAME" || return 1 - - run_az_command \ - "Set the default Azure Machine Learning workspace:" \ - az configure --defaults workspace="$WORKSPACE_NAME" -} - -create_compute_instance() { - run_az_command \ - "Creating a compute instance with name: $COMPUTE_INSTANCE" \ - az ml compute create --name "$COMPUTE_INSTANCE" --size "$COMPUTE_SIZE" --type ComputeInstance -} - -create_compute_cluster() { - run_az_command \ - "Creating a compute cluster with name: $COMPUTE_CLUSTER" \ - az ml compute create --name "$COMPUTE_CLUSTER" --size "$COMPUTE_SIZE" --max-instances 2 --type AmlCompute -} - -create_data_assets() { - run_az_command \ - "Create training data asset (MLTable):" \ - az ml data create --type mltable --name "diabetes-training" --path ../data/diabetes-data || return 1 - - run_az_command \ - "Create training data asset (CSV):" \ - az ml data create --type uri_file --name "diabetes-data" --path ../data/diabetes-data/diabetes.csv -} - -run_full_setup() { - check_prerequisites || return 1 - register_resource_provider || return 1 - create_resource_group || return 1 - create_workspace || return 1 - create_compute_instance || return 1 - create_compute_cluster || return 1 - create_data_assets || return 1 - - echo "" - echo "Setup complete." -} +# Register the Azure Machine Learning resource provider in the subscription +echo "Register the Machine Learning resource provider:" +az provider register --namespace $RESOURCE_PROVIDER -show_status() { - echo "Current configuration" - echo "=====================================================================" - echo "Suffix: $suffix" - echo "Resource Group: $RESOURCE_GROUP" - echo "Location: $RANDOM_REGION" - echo "Workspace: $WORKSPACE_NAME" - echo "Compute Instance: $COMPUTE_INSTANCE" - echo "Compute Cluster: $COMPUTE_CLUSTER" - echo "=====================================================================" - echo "Suggested order: 1 -> 2 -> 3 -> 4 -> 5, or use option 6." -} +# Create the resource group and workspace and set to default +echo "Create a resource group and set as default:" +az group create --name $RESOURCE_GROUP --location $RANDOM_REGION +az configure --defaults group=$RESOURCE_GROUP -show_menu() { - clear - echo "=====================================================================" - echo " Azure Machine Learning Lab Setup Menu" - echo "=====================================================================" - echo "Suffix: $suffix" - echo "Resource Group: $RESOURCE_GROUP" - echo "Location: $RANDOM_REGION" - echo "Workspace: $WORKSPACE_NAME" - echo "=====================================================================" - echo "1. Register Machine Learning resource provider" - echo "2. Create resource group and set defaults" - echo "3. Create Azure Machine Learning workspace" - echo "4. Create compute resources" - echo "5. Create data assets" - echo "6. Run full setup" - echo "7. Show configuration" - echo "8. Exit" - echo "=====================================================================" -} +echo "Create an Azure Machine Learning workspace:" +az ml workspace create --name $WORKSPACE_NAME +az configure --defaults workspace=$WORKSPACE_NAME -while true; do - show_menu - read -r -p "Please select an option (1-8): " choice +# Create compute instance +echo "Creating a compute instance with name: " $COMPUTE_INSTANCE +az ml compute create --name ${COMPUTE_INSTANCE} --size STANDARD_DS11_V2 --type ComputeInstance - case "$choice" in - 1) - echo "" - check_prerequisites && register_resource_provider - echo "" - read -r -p "Press Enter to continue..." - ;; - 2) - echo "" - check_prerequisites && create_resource_group - echo "" - read -r -p "Press Enter to continue..." - ;; - 3) - echo "" - check_prerequisites && create_workspace - echo "" - read -r -p "Press Enter to continue..." - ;; - 4) - echo "" - check_prerequisites && create_compute_instance && create_compute_cluster - echo "" - read -r -p "Press Enter to continue..." - ;; - 5) - echo "" - check_prerequisites && create_data_assets - echo "" - read -r -p "Press Enter to continue..." - ;; - 6) - echo "" - run_full_setup - echo "" - read -r -p "Press Enter to continue..." - ;; - 7) - echo "" - show_status - echo "" - read -r -p "Press Enter to continue..." - ;; - 8) - echo "Exiting..." - clear - exit 0 - ;; - *) - echo "" - echo "Invalid option. Please select 1-8." - echo "" - read -r -p "Press Enter to continue..." - ;; - esac +# Create compute cluster +echo "Creating a compute cluster with name: " $COMPUTE_CLUSTER +az ml compute create --name ${COMPUTE_CLUSTER} --size STANDARD_DS11_V2 --max-instances 2 --type AmlCompute - echo "" -done +# Create data assets +echo "Create training data asset:" +az ml data create --type mltable --name "diabetes-training" --path ../data/diabetes-data +az ml data create --type uri_file --name "diabetes-data" --path ../data/diabetes-data/diabetes.csv \ No newline at end of file diff --git a/infra/setup2.sh b/infra/setup2.sh new file mode 100644 index 0000000..2f317b8 --- /dev/null +++ b/infra/setup2.sh @@ -0,0 +1,256 @@ +#!/usr/bin/env bash + +set -u + +# Change the values of these variables as needed. +# You can also pass a suffix as the first argument when starting the script. + +DEFAULT_LOCATION="" +RESOURCE_PROVIDER="Microsoft.MachineLearningServices" +REGIONS=("eastus" "westus" "centralus" "northeurope" "westeurope") +COMPUTE_CLUSTER="aml-cluster" +COMPUTE_SIZE="STANDARD_DS11_V2" +MAX_RETRIES=3 +RETRY_DELAY=5 + +# ============================================================================ +# DON'T CHANGE ANYTHING BELOW THIS LINE. +# ============================================================================ + +generate_suffix() { + if command -v uuidgen >/dev/null 2>&1; then + uuidgen | tr '[:upper:]' '[:lower:]' | tr -d '-' | cut -c1-18 + else + printf '%(%s)T\n' -1 | tr -d '\n' | cut -c1-18 + fi +} + +if [[ -n "${1:-}" ]]; then + suffix=$(echo "$1" | tr '[:upper:]' '[:lower:]' | tr -cd 'a-z0-9' | cut -c1-18) +else + suffix=$(generate_suffix) +fi + +if [[ -z "$suffix" ]]; then + echo "Error: A valid suffix could not be determined." + exit 1 +fi + +if [[ -n "$DEFAULT_LOCATION" ]]; then + RANDOM_REGION="$DEFAULT_LOCATION" +else + RANDOM_REGION=${REGIONS[$RANDOM % ${#REGIONS[@]}]} +fi + +RESOURCE_GROUP="rg-ai300-l${suffix}" +WORKSPACE_NAME="mlw-ai300-l${suffix}" +COMPUTE_INSTANCE="ci${suffix}" + +run_az_command() { + local description="$1" + shift + + local attempt=1 + local exit_code=0 + + while (( attempt <= MAX_RETRIES )); do + echo "$description" + "$@" + exit_code=$? + + if [[ $exit_code -eq 0 ]]; then + return 0 + fi + + echo "Warning: command failed (attempt ${attempt}/${MAX_RETRIES})." + + if (( attempt == MAX_RETRIES )); then + echo "Error: unable to complete operation after ${MAX_RETRIES} attempts." + return $exit_code + fi + + echo "Retrying in ${RETRY_DELAY} seconds..." + sleep "$RETRY_DELAY" + attempt=$((attempt + 1)) + done + + return $exit_code +} + +require_command() { + if ! command -v "$1" >/dev/null 2>&1; then + echo "Error: Required command '$1' is not installed or not in PATH." + return 1 + fi +} + +check_prerequisites() { + echo "Checking prerequisites..." + + require_command az || return 1 + + if ! az account show >/dev/null 2>&1; then + echo "Error: Not authenticated with Azure. Please run: az login" + return 1 + fi + + echo "✓ Azure CLI is available and authenticated" +} + +register_resource_provider() { + run_az_command \ + "Register the Machine Learning resource provider:" \ + az provider register --namespace "$RESOURCE_PROVIDER" +} + +create_resource_group() { + run_az_command \ + "Create a resource group and set as default:" \ + az group create --name "$RESOURCE_GROUP" --location "$RANDOM_REGION" || return 1 + + run_az_command \ + "Set the default resource group:" \ + az configure --defaults group="$RESOURCE_GROUP" +} + +create_workspace() { + run_az_command \ + "Create an Azure Machine Learning workspace:" \ + az ml workspace create --name "$WORKSPACE_NAME" || return 1 + + run_az_command \ + "Set the default Azure Machine Learning workspace:" \ + az configure --defaults workspace="$WORKSPACE_NAME" +} + +create_compute_instance() { + run_az_command \ + "Creating a compute instance with name: $COMPUTE_INSTANCE" \ + az ml compute create --name "$COMPUTE_INSTANCE" --size "$COMPUTE_SIZE" --type ComputeInstance +} + +create_compute_cluster() { + run_az_command \ + "Creating a compute cluster with name: $COMPUTE_CLUSTER" \ + az ml compute create --name "$COMPUTE_CLUSTER" --size "$COMPUTE_SIZE" --max-instances 2 --type AmlCompute +} + +create_data_assets() { + run_az_command \ + "Create training data asset (MLTable):" \ + az ml data create --type mltable --name "diabetes-training" --path ../data/diabetes-data || return 1 + + run_az_command \ + "Create training data asset (CSV):" \ + az ml data create --type uri_file --name "diabetes-data" --path ../data/diabetes-data/diabetes.csv +} + +run_full_setup() { + check_prerequisites || return 1 + register_resource_provider || return 1 + create_resource_group || return 1 + create_workspace || return 1 + create_compute_instance || return 1 + create_compute_cluster || return 1 + create_data_assets || return 1 + + echo "" + echo "Setup complete." +} + +show_status() { + echo "Current configuration" + echo "=====================================================================" + echo "Suffix: $suffix" + echo "Resource Group: $RESOURCE_GROUP" + echo "Location: $RANDOM_REGION" + echo "Workspace: $WORKSPACE_NAME" + echo "Compute Instance: $COMPUTE_INSTANCE" + echo "Compute Cluster: $COMPUTE_CLUSTER" + echo "=====================================================================" + echo "Suggested order: 1 -> 2 -> 3 -> 4 -> 5, or use option 6." +} + +show_menu() { + clear + echo "=====================================================================" + echo " Azure Machine Learning Lab Setup Menu" + echo "=====================================================================" + echo "Suffix: $suffix" + echo "Resource Group: $RESOURCE_GROUP" + echo "Location: $RANDOM_REGION" + echo "Workspace: $WORKSPACE_NAME" + echo "=====================================================================" + echo "1. Register Machine Learning resource provider" + echo "2. Create resource group and set defaults" + echo "3. Create Azure Machine Learning workspace" + echo "4. Create compute resources" + echo "5. Create data assets" + echo "6. Run full setup" + echo "7. Show configuration" + echo "8. Exit" + echo "=====================================================================" +} + +while true; do + show_menu + read -r -p "Please select an option (1-8): " choice + + case "$choice" in + 1) + echo "" + check_prerequisites && register_resource_provider + echo "" + read -r -p "Press Enter to continue..." + ;; + 2) + echo "" + check_prerequisites && create_resource_group + echo "" + read -r -p "Press Enter to continue..." + ;; + 3) + echo "" + check_prerequisites && create_workspace + echo "" + read -r -p "Press Enter to continue..." + ;; + 4) + echo "" + check_prerequisites && create_compute_instance && create_compute_cluster + echo "" + read -r -p "Press Enter to continue..." + ;; + 5) + echo "" + check_prerequisites && create_data_assets + echo "" + read -r -p "Press Enter to continue..." + ;; + 6) + echo "" + run_full_setup + echo "" + read -r -p "Press Enter to continue..." + ;; + 7) + echo "" + show_status + echo "" + read -r -p "Press Enter to continue..." + ;; + 8) + echo "Exiting..." + clear + exit 0 + ;; + *) + echo "" + echo "Invalid option. Please select 1-8." + echo "" + read -r -p "Press Enter to continue..." + ;; + esac + + echo "" +done