Created
January 28, 2023 16:42
-
-
Save chrisfcarroll/0f14475f484bc3981b355a4821c48975 to your computer and use it in GitHub Desktop.
Show some example az cli commands to create and delete a VM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env sh | |
cat << 'EOF' | |
Get pricing: | |
location.href="https://prices.azure.com/api/retail/prices?$skip=0¤cyCode='GBP'&$filter=location eq 'UK South' and serviceName eq 'Virtual Machines' and priceType eq 'Consumption'" | |
Create Spot VM | |
az vm create -g VM --name VM --admin-username azureuser --image CentOS --generate-ssh-keys --public-ip-sku Standard --priority Spot --eviction-policy Delete | |
Destroy VM | |
az vm delete --name DSVM -g VM --yes | |
Install dotnet on CentOS | |
``` | |
sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm | |
sudo yum -y install tmux | |
tmux sudo yum -y dotnet-sdk-7.0 | |
``` | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment