8 vm_size
="Standard_D2s_v3"; os_size
=42;
11 az group create
--location "westus2" --name "${group}"
12 group_id
="$(az group show --name "${group}" -o tsv --query "[id
]")"
15 if ! az identity show
-n "${group}-identity" -g "${group}" &>/dev
/stderr
; then
16 az identity create
--name "${group}-identity" --resource-group "${group}"
19 # (optional) role assignment, to the resource group, bad but not really great alternatives
20 identity_id
="$(az identity show --name "${group}-identity" --resource-group "${group}" -o tsv --query "[id
]")"
21 principal_id
="$(az identity show --name "${group}-identity" --resource-group "${group}" -o tsv --query "[principalId
]")"
22 until az role assignment create
--assignee "${principal_id}" --role "Owner" --scope "${group_id}"; do sleep 1; done
26 --name "${group}-vm" \
27 --resource-group "${group}" \
28 --assign-identity "${identity_id}" \
30 --os-disk-size-gb "${os_size}" \
32 --admin-username "${USER}" \
33 --location "westus2" \
34 --storage-sku "Premium_LRS" \
35 --ssh-key-values "$(ssh-add -L)"