Skip to content
This repository was archived by the owner on Dec 12, 2025. It is now read-only.

Commit

Permalink
Azure: Dev env script updates (untested).
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiddelkoop committed Feb 10, 2022
1 parent a6abf2b commit bdd986b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions scripts/azure-create.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,24 @@ echo "+++ creating resource group $RESOURCE_GROUP $SUBSCRIPTION"
az group create --resource-group $RESOURCE_GROUP --location $LOCATION

echo "+++ creating VM $VM"
# Ubuntu is "Canonical:0001-com-ubuntu-server-focal:20_04-lts:latest"
# Ubuntu is "Canonical:0001-com-ubuntu-server-focal:20_04-lts-gen2:latest"
# Debian is "Debian:debian-10:10:latest"
# Resource Group scope "subscriptions/$SUBSCRIPTION/resourceGroups/$RESOURCE_GROUP"
az vm create --resource-group $RESOURCE_GROUP --name $VM \
--image Canonical:0001-com-ubuntu-server-focal:20_04-lts:latest \
--image Canonical:0001-com-ubuntu-server-focal:20_04-lts-gen2:latest \
--size Standard_D2_v4 \
--storage-sku Standard_LRS \
--storage-sku StandardSSD_LRS \
--public-ip-sku Standard \
--assign-identity \
--scope "subscriptions/$SUBSCRIPTION/resourceGroups/$RESOURCE_GROUP" \
--role Contributor \
--admin-username $NAME

echo "+++ get IP for $VM"
IP=$(az vm show --name $VM --resource-group $RESOURCE_GROUP -d --query publicIps -otsv)
IDENTITY=$(az vm show --name $VM --resource-group $RESOURCE_GROUP --query identity.principalId -otsv)

echo "+++ assign the VM the Contributor role to the subscription ($IDENTITY to $SUBSCRIPTION)"
az role assignment create --assignee $IDENTITY --scope /subscriptions/$SUBSCRIPTION --role Contributor

echo "+++ wait for boot and cloud-init ${VM} ${IP}"
ssh-keygen -R $IP
ssh-keygen -R "$IP"
while ! ssh $NAME@$IP sudo cloud-init status --wait ; do
sleep 1
done
Expand Down

0 comments on commit bdd986b

Please sign in to comment.