Project

General

Profile

Azure VPS setup notes » History » Version 10

Jon Goldberg, 08/17/2020 06:06 PM

1 1 Jon Goldberg
# Azure VPS setup notes
2
3 6 Jon Goldberg
Azure is more complex than, say, Linode.  To set up a free account, you must:
4
* Get a Sponsorship.
5
* Create a Subscription linked to the Sponsorship.
6
* Create a Resource Group linked to the Subscription.
7
* Create a Virtual Machine (and associated resources) linked to the Resource Group.
8 1 Jon Goldberg
9 6 Jon Goldberg
[**NOTE**: Most of Microsoft's pages break with an ad blocker enabled.]
10
11
### Get a Sponsorship
12
* [Go to the Nonprofit Microsoft Getting Started page](https://nonprofit.microsoft.com/en-us/getting-started).  Fill out the paperwork to be approved as a 501c3.  Approval can take 1 day or 3-4 weeks - I've seen both multiple times.
13 7 Jon Goldberg
* Once approved, go to https://www.microsoft.com/en-us/nonprofits/azure to claim credits.
14 6 Jon Goldberg
15
### Create a Subscription
16
17 1 Jon Goldberg
* Check that you have credits in your sponsored account: https://www.microsoftazuresponsorships.com/Balance
18 6 Jon Goldberg
* Visit the [Azure Portal](https://portal.azure.com).  
19
* Click the **Subscriptions** icon.
20
* Click the **Add** button.
21
* Add a subscription of type "Microsoft Azure Sponsorship" from the Azure portal. You will likely need to select **Show other subscription types** to see it.
22 1 Jon Goldberg
 * **Note**: Even sponsored subscriptions require a credit card, make sure you have one available.
23
24 6 Jon Goldberg
#### Create a resource group
25
* Select "Resource Group" from the main Azure portal.  
26
* Select **Add** and give it a name.
27
* Your subscription should be pre-selected since you only have the one.
28
* Click **Review and Create**.
29 1 Jon Goldberg
30 6 Jon Goldberg
#### Create a virtual machine
31
* Click on your new resource group in the Azure Portal.
32
* Click **Add**.
33
* Search for the name of the image you want (e.g. Debian).
34
* See the screenshots below for configuration of the "Basics" and "Disk" tabs.  The other tabs I keep with the defaults.
35
* I've attached a downloaded template for this VM, which as of now I haven't used yet, not sure how it works.
36 1 Jon Goldberg
37 9 Jon Goldberg
![Create a VM - Basics Tab](https://hq.megaphonetech.com/attachments/download/1771/Selection_999(010).png)
38
39
![Create a VM - Disks Tab](https://hq.megaphonetech.com/attachments/download/1770/Selection_999(011).png)
40
41 6 Jon Goldberg
#### Post-provisioning configuration
42 5 Jon Goldberg
43 10 Jon Goldberg
##### Partition and format the attached disk
44
Your VM (if it's D2s v3) will have an "OS disk" of 30GB it ships with.  Your attached disk is unformatted.  Partition and format the new disk with:
45
46
```shell
47
sudo parted --script -a optimal /dev/sdb mklabel gpt -- mkpart primary ext4 '0%' '100%'
48
sudo mkfs -t ext4 /dev/sdb1 
49
```
50
51
FIXME: How can we use this as the only disk?
52
53 6 Jon Goldberg
##### Modify Firewall Rules
54
* Click on your new virtual machine in the Azure portal.
55
* Click **Networking** in the side navigation.
56
* You should see your firewall settings.  They should look like the screenshot below, except they'll be missing the two items circled.
57
* Add the "allow_ping" and "Port_5665" rules to the *Inbound Port Rules* as shown in the screenshot.
58
59 8 Jon Goldberg
![Firewall Rules](https://hq.megaphonetech.com/attachments/download/1772/Selection_999(012).png)
60
61 6 Jon Goldberg
##### Add a swapfile
62
[Complete instructions are here](https://support.microsoft.com/en-us/help/4010058/how-to-add-a-swap-file-in-linux-azure-virtual-machines) but in short, add this to `/etc/waagent.conf` for an 8GB swapfile:
63
64
```
65
    ResourceDisk.Format=y
66
    ResourceDisk.EnableSwap=y
67
    ResourceDisk.SwapSizeMB=8192
68
```
69
70
Then run `service walinuxagent restart`.