-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathQuick-Setup.ps1
57 lines (43 loc) · 1.74 KB
/
Quick-Setup.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Param(
[Parameter(Mandatory, HelpMessage="Please provide a valid conda env name.")]
$EnvName,
[Parameter(Mandatory, HelpMessage="Please provide your Azure subcription id")]
$SubId,
[Parameter(Mandatory, HelpMessage="Please provide your Azure resource group name")]
$ResourceGroup,
[Parameter(Mandatory, HelpMessage="Please provide your AzureML workspance name")]
$Workspace
)
function Create-ConfigJson(
$sub_id, $rg_name, $ws_name
) {
$json_config = @{}
$json_config["subscription_id"] = $sub_id
$json_config["resource_group"] = $rg_name
$json_config["workspace_name"] = $ws_name
ConvertTo-Json $json_config | Out-File -FilePath 'config.json' -Encoding ascii
}
function Create-ComponentConfigJson(
$version
) {
$json_config = @{}
$json_config["version"] = $version
ConvertTo-Json $json_config | Out-File -FilePath 'component_config.json' -Encoding ascii
}
Write-Host "=-= Creating conda environment '$EnvName' with python v3.9"
conda create -y -n $EnvName python=3.9
conda activate $EnvName
Write-Host "=-= Installing nbconda"
conda install nbconda
Write-Host "=-= Installing other requirements"
pip install -r requirements.txt
Write-Host "=-= Creating workspace config JSON"
Create-ConfigJson $SubId $ResourceGroup $Workspace
Write-Host "=-= Creating component config JSON"
Create-ComponentConfigJson -version 1
Write-Host "=-= Registering RAI components"
python scripts/register_azureml.py --workspace_config config.json --component_config component_config.json --base_directory .
Write-Host "=-= Setting default subscription"
az account set -s $SubId
Write-Host "=-= Setting default resource group and workspace"
az configure --defaults group=$ResourceGroup workspace=$Workspace