TODO: rewrite for the AZD environment
Ensure you have the Azure CLI installed. You can download and install it from the following link: Install Azure CLI
It is recommended to run the installer locally instead of using CloudShell due to potential timeouts.
Login to Azure using the following command and provide your credentials:
az loginClone the repository and navigate to the MachineLearningBicep directory:
git clone https://github.com/rob-foulkrod/MachineLearningBicep.git
cd MachineLearningBicepExecute the PowerShell script:
./run.ps1- resourceGroupName: The name of the resource group. Default is
aml-rg. - location: The Azure region where the resources will be deployed. Default is
eastus2. - prefix: The prefix for naming resources. Default is
aml.
To run the script with custom parameters, use the following command:
./run.ps1 -resourceGroupName "myResourceGroup" -location "eastus" -prefix "myPrefix"Alternatively, you can use the shorthand version:
./run.ps1 -r "myResourceGroup" -l "eastus" -p "myPrefix"This script is an extension for users who may have additional storage accounts that contain samples or demo material. It assigns the appropriate permissions to the selected storage account for Azure Machine Learning (ML) workspaces and compute instances.
All parameters are optional
storageRGName(string): The name of the resource group containing the storage account.storageAccountName(string): The name of the storage account.workspaceRGName(string): The name of the resource group containing the Azure ML workspace.workspaceName(string): The name of the Azure ML workspace.computeInstanceName(string): The name of the compute instance within the Azure ML workspace.userId(string): The user ID of the current user. If not provided, the script will retrieve the current user's principal ID.
- Retrieves the subscription ID of the current Azure account.
- If
userIdis not provided, retrieves the current user's principal ID. - If
storageAccountNameis not provided, lists all storage accounts in the subscription and prompts the user to select one. - If
workspaceNameis not provided, lists all Azure ML workspaces in the subscription and prompts the user to select one. - If
computeInstanceNameis not provided, lists all compute instances in the selected workspace and prompts the user to select one. - Retrieves the identities of the selected Azure ML workspace and compute instance.
- Assigns the following roles to the workspace identity on the selected storage account:
- Storage Account Contributor
- Storage Blob Data Contributor
- Storage File Data Privileged Contributor
- Assigns the following roles to the compute instance identity on the selected storage account:
- Storage Blob Data Contributor
- Storage File Data Privileged Contributor
- Assigns the following roles to the current user identity on the selected storage account:
- Storage Blob Data Contributor
- Storage File Data Privileged Contributor
Run the script with the required parameters. If any parameters are not provided, the script will prompt the user to select from available options.
To run the AddStorage.ps1 script without any parameters, use the following command:
./AddStorage.ps1The script will prompt you to select from available options for any parameters that are not provided.
To run the AddStorage.ps1 script with all parameters, use the following command:
./AddStorage.ps1 -storageRGName "storageResourceGroup" -storageAccountName "mystorageaccount" -workspaceRGName "workspaceResourceGroup" -workspaceName "myWorkspace" -computeInstanceName "myComputeInstance" -userId "00000000-0000-0000-0000-000000000000"