Created
March 17, 2024 07:12
-
-
Save ianscrivener/962a6296ca81dbab5a129af4f6690fc2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| export AZ_MAIN_NAME=Kube2 | |
| export AZ_RG=RG_$AZ_MAIN_NAME | |
| export AZ_VNET=VNET_$AZ_MAIN_NAME | |
| export AZ_IP=Public_IP_$AZ_MAIN_NAME | |
| export AZ_SUBNET=Subnet_$AZ_MAIN_NAME | |
| export AZ_NSG=NetworkSecurityGroup_$AZ_MAIN_NAME | |
| export AZ_NAME=VM_$AZ_MAIN_NAME | |
| export AZ_NIC=NIC_$AZ_MAIN_NAME | |
| ENV | grep AZ | |
| az group create \ | |
| --name $AZ_RG \ | |
| --location australiaeast | |
| az network vnet create \ | |
| --resource-group $AZ_RG \ | |
| --name $AZ_VNET \ | |
| --address-prefix 192.168.0.0/16 \ | |
| --subnet-name $AZ_SUBNET \ | |
| --subnet-prefix 192.168.1.0/24 | |
| az network public-ip create \ | |
| --resource-group $AZ_RG \ | |
| --name $AZ_IP \ | |
| --dns-name publicdnskube2 | |
| az network nsg create \ | |
| --resource-group $AZ_RG \ | |
| --name $AZ_NSG | |
| az network nsg rule create \ | |
| --resource-group $AZ_RG \ | |
| --nsg-name $AZ_NSG \ | |
| --name "$AZ_NSG-GroupRule_SSH" \ | |
| --protocol tcp \ | |
| --priority 1000 \ | |
| --destination-port-range 22 \ | |
| --access allow | |
| az network nsg rule create \ | |
| --resource-group $AZ_RG \ | |
| --nsg-name $AZ_NSG \ | |
| --name $AZ_NSG-GroupRule_Web \ | |
| --protocol tcp \ | |
| --priority 1001 \ | |
| --destination-port-range 80 \ | |
| --access allow | |
| az network nic create \ | |
| --resource-group $AZ_RG \ | |
| --name $AZ_NIC \ | |
| --vnet-name $AZ_VNET \ | |
| --subnet $AZ_SUBNET \ | |
| --public-ip-address $AZ_IP \ | |
| --network-security-group $AZ_NSG | |
| az vm create \ | |
| --resource-group $AZ_RG \ | |
| --name VM_Kube2 \ | |
| --location australiaeast \ | |
| --nics $AZ_NIC \ | |
| --image Ubuntu2204 \ | |
| --admin-username azureuser \ | |
| --ssh-key-value ~/.ssh/id_rsa.pub \ | |
| --custom-data cloud-init.txt | |
| # keyvault_name=mykeyvault | |
| # az keyvault create \ | |
| # --resource-group myResourceGroupAutomate \ | |
| # --name $keyvault_name \ | |
| # --enabled-for-deployment | |
| # | |
| # az keyvault certificate create \ | |
| # --vault-name $keyvault_name \ | |
| # --name mycert \ | |
| # --policy "$(az keyvault certificate get-default-policy --output json)" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment