forked from Azure/azureml-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
copy-data.sh
46 lines (35 loc) · 1.56 KB
/
copy-data.sh
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
# setup variables
datapath="example-data"
datastore="workspaceblobstore"
# query subscription and group
subscription=$(az account show --query id -o tsv)
group=$(az ml workspace show --query resource_group -o tsv)
# query principal
principal=$(az ad signed-in-user show --query objectId -o tsv)
# query datastore
account=$(az ml datastore show -n $datastore --query account_name -o tsv)
container=$(az ml datastore show -n $datastore --query container_name -o tsv)
endpoint=$(az ml datastore show -n $datastore --query endpoint -o tsv)
protocol=$(az ml datastore show -n $datastore --query protocol -o tsv)
# build strings
destination="$protocol://$account.blob.$endpoint/$container/$datapath/"
# give access to blob container
az role assignment create \
--role "Storage Blob Data Owner" \
--assignee $principal \
--scope "/subscriptions/$subscription/resourceGroups/$group/providers/Microsoft.Storage/storageAccounts/$account"
# let permissions propogate
sleep 360
for i in {0..1}
do
# copy iris data
azcopy cp "https://azuremlexamples.blob.core.windows.net/datasets/iris.csv" $destination
# copy diabetes data
azcopy cp "https://azuremlexamples.blob.core.windows.net/datasets/diabetes.csv" $destination
# copy titanic data
azcopy cp "https://azuremlexamples.blob.core.windows.net/datasets/titanic.csv" $destination
# copy mnist data
azcopy cp "https://azuremlexamples.blob.core.windows.net/datasets/mnist" $destination --recursive
# copy cifar data
azcopy cp "https://azuremlexamples.blob.core.windows.net/datasets/cifar-10-python.tar.gz" $destination
done