Azure-Machine-Learning-Adop.../automated_assessment
Xiao Zhang baf3ed08c2
Update test.py
remove credential
2024-07-23 10:23:02 +08:00
..
azext_mlclassicextension add the automated assessment tool 2021-08-18 16:49:05 +08:00
README.md edit readme 2021-08-19 18:26:36 +08:00
automated-assessment-report.ps1 edit readme 2021-08-19 18:26:36 +08:00
setup.cfg add the automated assessment tool 2021-08-18 16:49:05 +08:00
setup.py add the automated assessment tool 2021-08-18 16:49:05 +08:00
test.py Update test.py 2024-07-23 10:23:02 +08:00

README.md

Azure Machine Learning Adoption Framework Automated Assessment Tool

This tool is an Azure CLI exention to automatically list Machine Learning Studio(classic) assets (worksapce, web services, datasets, experiments etc) of a given subscription. It helps to inventory ML Studio(classic) assets and locate assets owner.

NOTE

This tool only list the paid ML Studio(classic) assets. Free workspaces will not be listed.

Build the automated assessment tool

To build the automated assessment tool, run the following command in the automated_assessment folder (make sure you have an active Pyhon environment):

python setup.py bdist_wheel

Use the automated assessment tool

NOTE

The examples below demonstrate the use of Azure CLI (including the ML Classic extension) in a PowerShell environment. For more details on AZ execution environments, check the Choose the right command-line tool for Azure section in the documentation.

  1. Install the az mlclassic extension

    az extension add --source .\dist\mlclassic-1.0.0-py2.py3-none-any.whl
    

    If you are upgrading from a previous version of the tool, you can remove the old version using

    az extension remove --name mlclassic
    
  2. Login with an Azure AD account

    Make sure your account has proper permissions to access the ML Classic workspaces, and set the subscription you want to analyze.

     az login
     az account list 
     az account set --subscription "Your subscription here"
    
  3. Run the automated-assessment-report PowerShell script

    The script will execute the CLI commands in below sesction for all the worksapces under the subscription you set in step 2. Make sure you set the path in the $reportPath variable. The script will save the asset inventory report in the path you set.

Features of the automated assessment tool

This section explains the functionality of each command in the tool. If you want to generate a report of ML Studio(classic) assets under a given subscrption, run the automated assessment report script.

  1. List all ML Classic workspaces.

    $mlClassicWorkspaces = az resource list --resource-type Microsoft.MachineLearning/Workspaces | ConvertFrom-Json
    
  2. Get the details of a selected workspace.

    $mlClassicWorkspace = az resource show --ids $mlClassicWorkspaces[0].id | ConvertFrom-Json
    
  3. Get the workspace id, workspace location, workspace access keys, and API url.

    $mlClassicWorkspaceId = $mlClassicWorkspace.properties.workspaceId
    $mlClassicWorkspaceLocation = $mlClassicWorkspace.location.ToLower().Replace(" ", "")
    $mlClassicWorkspaceKeys = az resource invoke-action --action listworkspacekeys --ids $mlClassicWorkspaces[0].id | ConvertFrom-Json
    $mlClassicApi = $mlClassicWorkspace.properties.studioEndpoint
    
  4. Get the ML Classic workspace properties

    az mlclassic workspace show -wid $mlClassicWorkspaceId -wl $mlClassicWorkspaceLocation -wapi $mlClassicApi -wat $mlClassicWorkspaceKeys.primaryToken
    
  5. Get the ML classic project in a workspace

    $mlClassicProjects = az mlclassic workspace projects -wid $mlClassicWorkspaceId -wl $mlClassicWorkspaceLocation -wapi $mlClassicApi -wat $mlClassicWorkspaceKeys.primaryToken | ConvertFrom-Json
    
  6. Get the ML classic experiment id and details

    $mlClassicExperiments = az mlclassic workspace experiments -wid $mlClassicWorkspaceId -wl $mlClassicWorkspaceLocation -wapi $mlClassicApi -wapi $mlClassicApi -wat $mlClassicWorkspaceKeys.primaryToken | ConvertFrom-Json
    $mlClassicExperimentId = $mlClassicExperiments[0].ExperimentId
    $mlClassicExperiment = az mlclassic workspace experiment -wid $mlClassicWorkspaceId -wl $mlClassicWorkspaceLocation -wapi $mlClassicApi -wat $mlClassicWorkspaceKeys.primaryToken -eid $mlClassicExperimentId | ConvertFrom-Json
    
  7. Get the ML classic webservices, webservice id, and webservice details

    $mlClassicWebservices = az mlclassic workspace webservices -wid $mlClassicWorkspaceId -wl $mlClassicWorkspaceLocation -wapi $mlClassicApi -wat $mlClassicWorkspaceKeys.primaryToken | ConvertFrom-Json
    $mlClassicWebserviceId = $mlClassicWebservices[0].Id
    $mlClassicWebservice = az mlclassic workspace webservice -wid $mlClassicWorkspaceId -wl $mlClassicWorkspaceLocation -wapi $mlClassicApi -wat $mlClassicWorkspaceKeys.primaryToken -wsid $mlClassicWebserviceId | ConvertFrom-Json
    
  8. Get the ML classic new webservices, new webservice id, and new webservice details

    $mlClassicNewWebservices = az resource list --resource-type Microsoft.MachineLearning/WebServices | ConvertFrom-Json
    $mlClassicNewWebserviceId = $mlClassicNewWebservices[0].id
    $mlClassicNewWebservice = az resource show --ids $mlClassicNewWebserviceId | ConvertFrom-Json
    
  9. Get ML classic commitment plans, commitment plan id, commitment plan details, and commitment plan associations

    $mlClassicCommitmentPlans = az resource list --resource-type Microsoft.MachineLearning/CommitmentPlans | ConvertFrom-Json
    $mlClassicCommitmentPlanId = $mlClassicCommitmentPlans[0].id
    $mlClassicCommitmentPlan = az resource show --ids $mlClassicCommitmentPlanId | ConvertFrom-Json
    $mlClassicCommitmentPlanAssociations = (az rest -u "https://management.azure.com$($mlClassicCommitmentPlanId)/commitmentAssociations?api-version=2016-05-01-preview" | ConvertFrom-Json).value