Created
November 12, 2019 22:45
-
-
Save berberich/b1a3aa5cb08ca05c7280f795896061ee to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# Update for your admin password | |
AdminPassword=MySup3RS3cRe7P@S$W0Rd | |
# Create a resource group. | |
# az group create --name myResourceGroup --location eastus | |
az network vnet create --resource-group myResourceGroup --name sqlvmVnet --subnet-name sqlSubnet | |
# Create a public IP address. | |
az network public-ip create --resource-group myResourceGroup --name myPublicIP | |
# Create a network security group. | |
az network nsg create --resource-group myResourceGroup --name myNetworkSecurityGroup | |
# Create a virtual network card and associate with public IP address and NSG. | |
az network nic create \ | |
--resource-group myResourceGroup \ | |
--name myNic \ | |
--vnet-name sqlvmVnet \ | |
--subnet sqlSubnet \ | |
--network-security-group myNetworkSecurityGroup \ | |
--public-ip-address myPublicIP | |
# Create a virtual machine. | |
az vm create \ | |
--resource-group myResourceGroup \ | |
--name sqlVM \ | |
--location westus2 \ | |
--nics myNic \ | |
--image MicrosoftSQLServer:SQL2016SP2-WS2016:Standard:Latest \ | |
--size Standard_D3_v2 | |
--admin-username azureuser \ | |
--admin-password $AdminPassword | |
# Open port 3389 to allow RDP traffic to host. | |
az vm open-port --port 3389 --resource-group myResourceGroup --name sqlVM | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment