Skip to content

Instantly share code, notes, and snippets.

@chrisfcarroll
Created January 28, 2023 16:42
Show Gist options
  • Save chrisfcarroll/0f14475f484bc3981b355a4821c48975 to your computer and use it in GitHub Desktop.
Save chrisfcarroll/0f14475f484bc3981b355a4821c48975 to your computer and use it in GitHub Desktop.
Show some example az cli commands to create and delete a VM
#! /usr/bin/env sh
cat << 'EOF'
Get pricing:
location.href="https://prices.azure.com/api/retail/prices?$skip=0&currencyCode='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