Skip to content

Commit e1fd1dd

Browse files
authored
Merge pull request #46 from MikeT-gh/coda-012
Initial issue #12 commit
2 parents cafe5f6 + a381fc4 commit e1fd1dd

File tree

1 file changed

+205
-0
lines changed

1 file changed

+205
-0
lines changed
Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
# How to install Landscape Server on Microsoft Azure
2+
3+
This guide provides an example of how to install and set up your Landscape server on Microsoft Azure with [cloud-init](https://cloudinit.readthedocs.io/en/latest/). The instructions here can be used for standard or FIPS-compliant deployments.
4+
5+
> **For the most up-to-date documentation on Microsoft Azure, see [Microsoft's Azure documentation](https://learn.microsoft.com/en-us/azure).
6+
7+
**Contents:**
8+
9+
- Install and set up Microsoft Azure CLI
10+
- Provision Azure resources
11+
- Deploy Landscape Server VM with cloud-init
12+
- Configure Landscape
13+
- (Optional) Perform a complete teardown
14+
15+
16+
## Install and set up Microsoft Azure CLI
17+
18+
### Install `Azure CLI`
19+
20+
To install `Azure CLI`, refer to the [Install Azure CLI on Ubuntu](https://documentation.ubuntu.com/azure/en/latest/azure-how-to/instances/install-azure-cli/) guide.
21+
22+
### Connect `Azure` with your Microsoft Azure account
23+
24+
The Azure CLI's default authentication method for logins uses a web browser and access token to sign in. To login, run:
25+
```
26+
az login
27+
```
28+
29+
If the Azure CLI can open your default browser, it will open the default browser and load an Azure sign-in page for you to sign in with your Azure account. Otherwise, it will instruct you to open a browser page and enter the code displayed in your terminal.
30+
31+
Sign in with your account credentials in the browser. For more information on signing in with the Azure CLI, see [Microsoft's documentation on signing in interactively with the Azure CLI](https://learn.microsoft.com/en-us/cli/azure/authenticate-azure-cli-interactively).
32+
33+
34+
## Provision Azure resources
35+
36+
### Create a resource group
37+
38+
Create a resource group to contain all the Azure resources for deploying the VM. The following command creates a resource group named `Landscape-rg` in the `eastus` location:
39+
```
40+
az group create --name Landscape-rg --location eastus
41+
```
42+
43+
Output will be displayed in JSON format:
44+
```
45+
{
46+
"id": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/Landscape-rg",
47+
"location": "eastus",
48+
"managedBy": null,
49+
"name": "Landscape-rg",
50+
"properties": {
51+
"provisioningState": "Succeeded"
52+
},
53+
"tags": null,
54+
"type": "Microsoft.Resources/resourceGroups"
55+
}
56+
```
57+
58+
### Create public-ip address resource
59+
60+
Create a static IP address in the `Landscape-rg` resource group:
61+
```
62+
az network public-ip create \
63+
--resource-group Landscape-rg \
64+
--name LandscapePublicIP \
65+
--location eastus \
66+
--allocation-method Static
67+
```
68+
69+
Output will be displayed in JSON format and will show a static IP address:
70+
```
71+
"ipAddress": "34.XXX.XXX.XXX",
72+
"ipTags": [],
73+
"location": "eastus",
74+
"name": "LandscapePublicIP",
75+
"provisioningState": "Succeeded",
76+
"publicIPAddressVersion": "IPv4",
77+
"publicIPAllocationMethod": "Static",
78+
"resourceGroup": "Landscape-rg",
79+
```
80+
81+
Copy the IP address and set it as the A record value for the domain or subdomain that will serve as the FQDN. You set the A record in your DNS service. You can also use Azure DNS zone to host your DNS domain and manage your DNS records.
82+
83+
Verify the A record using `nslookup`. Replace `{landscape.domain.com}` with your FQDN:
84+
85+
```
86+
nslookup {landscape.domain.com}
87+
```
88+
89+
You’ll receive output similar to:
90+
```
91+
Server: 127.0.0.53
92+
Address: 127.0.0.53#53
93+
94+
Non-authoritative answer:
95+
Name: landscape.domain.com
96+
Address: 34.XXX.XXX.XXX
97+
```
98+
99+
If the address value in the `nslookup` output matches the value of the `LandscapePublicIP` static IP address, the LetsEncrypt SSL provisioning step defined in the cloud-init configuration automation template will succeed.
100+
101+
102+
## Deploy Landscape Server VM with cloud-init
103+
104+
Before beginning the deployment process with cloud-init, you must choose which of the two cloud-init configuration automation templates you want to use. In the [Landscape Scripts](https://github.com/canonical/landscape-scripts) Github repository, there are two Landscape Quickstart cloud-init configuration templates: [`cloud-init-quickstart.yaml`](https://github.com/canonical/landscape-scripts/blob/main/provisioning/cloud-init-quickstart.yaml) and [`cloud-init-quickstart-fips.yaml`](https://github.com/canonical/landscape-scripts/blob/main/provisioning/cloud-init-quickstart-fips.yaml).
105+
106+
The `cloud-init-quickstart.yaml` template is designed for anyone, and the `cloud-init-quickstart-fips.yaml` is designed for FIPS compliant deployments of Landscape Server. For more information, see [how to install FIPS-compliant Landscape Server](https://ubuntu.com/landscape/docs/install-fips-hardened-landscape-server).
107+
108+
Once you’ve chosen your configuration template, complete the following steps.
109+
110+
1. Set the `IMAGE_FAMILY` environment variable based on the cloud-init configuration you chose.
111+
112+
- If you’re using `cloud-init-quickstart.yaml`, run:
113+
```
114+
curl -s https://raw.githubusercontent.com/canonical/landscape-scripts/main/provisioning/cloud-init-quickstart.yaml -o cloud-init.yaml
115+
IMAGE_FAMILY=Canonical:0001-com-ubuntu-pro-jammy:pro-22_04-lts-gen2:latest
116+
```
117+
118+
- If you’re using `cloud-init-quickstart-fips.yaml`, run:
119+
```
120+
curl -s https://raw.githubusercontent.com/canonical/landscape-scripts/main/provisioning/cloud-init-quickstart-fips.yaml -o cloud-init.yaml
121+
IMAGE_FAMILY=Canonical:0001-com-ubuntu-pro-focal-fips:pro-fips-20_04-gen2:latest
122+
```
123+
124+
2. Open the downloaded cloud-init YAML file in an editor, determine which configuration parameters need to be changed between lines 4 and 32 and change these parameters.
125+
126+
The `HOSTNAME` on line 16 and `DOMAIN` on line 19 must be changed. Updating `EMAIL` on line 9, and adding your SendGrid API key on line 29 as the `SMTP_PASSWORD` are optional.
127+
128+
129+
### Create VM
130+
131+
> [!NOTE]
132+
> Microsoft recommends not storing sensitive data in custom data such as cloud-init. For more information, see [Microsoft's documentation on custom data and cloud-init for virtual machines](https://learn.microsoft.com/en-us/azure/virtual-machines/custom-data).
133+
134+
Run the following commands to create a VM and add a security rule to the network security group (NSG) to open port 80 and 443. These ports are required to be open to allow the LetsEncrypt SSL provisioning step defined in the cloud-init to succeed. The `--generate-ssh-keys` parameter causes the CLI to look for an available ssh key in `~/.ssh`. If one is found, that key is used. If not, one is generated and stored in `~/.ssh`. The `--custom-data` parameter to pass in the cloud-init config file. Provide the full path to the `cloud-init.yaml` config if you saved the file outside of your present working directory:
135+
```
136+
az vm create \
137+
--resource-group Landscape-rg \
138+
--name LandscapeVM \
139+
--image $IMAGE_FAMILY \
140+
--size Standard_D2s_v3 \
141+
--admin-username azureuser \
142+
--generate-ssh-keys \
143+
--public-ip-address LandscapePublicIP \
144+
--custom-data cloud-init.yaml
145+
az vm open-port \
146+
--resource-group Landscape-rg \
147+
--name LandscapeVM \
148+
--port 80,443 \
149+
--priority 100
150+
```
151+
152+
It usually takes a few minutes to create the VM and supporting resources.
153+
154+
> [!NOTE]
155+
> When creating the VM an error may occur with the code `MarketplacePurchaseEligibilityFailed`. This error indicates that before the subscription can use this image, you need to accept the legal terms of the image. You can view and accept the terms via the Azure CLI. Refer to [Microsoft's documentation on VM image terms](https://learn.microsoft.com/en-us/cli/azure/vm/image/terms).
156+
157+
Observe the process by tailing the `cloud-init-output.log` file. Replace `{landscape.domain.com}` with your FQDN or static IP address:
158+
```
159+
ssh azureuser@{landscape.domain.com} 'tail -f /var/log/cloud-init-output.log'
160+
```
161+
162+
A reboot may be required during the cloud-init process. If a reboot is required, you’ll receive output similar to:
163+
```
164+
2023-08-20 17:30:04,721 - cc_package_update_upgrade_install.py[WARNING]: Rebooting after upgrade or install per /var/run/reboot-required
165+
```
166+
167+
If the `IMAGE_FAMILY` specified earlier contained all the security patches, this reboot step may not occur.
168+
169+
Repeat the following code if a reboot was necessary to continue observing the log file:
170+
```
171+
ssh azureuser@{landscape.domain.com} 'tail -f /var/log/cloud-init-output.log'
172+
```
173+
174+
Wait until the cloud-init process is complete. When it’s complete, you’ll receive output similar to:
175+
```
176+
cloud-init v. 23.2.2-0ubuntu0~22.04.1 finished at Sun, 20 Aug 2023 17:30:56 +0000. Datasource DataSourceAzure [seed=/dev/sr0]. Up 37.35 seconds
177+
```
178+
179+
Press `CTRL + C` to terminate the tail process in your terminal window.
180+
181+
182+
## Configure Landscape
183+
184+
1. Navigate to the Landscape web portal by entering the FQDN of the Landscape VM into a browser window
185+
186+
2. Provide a name, email address, and password for the first global administrator on the machine.
187+
188+
If the email address Landscape sends emails from should not be a subdomain based on the machine’s hostname, remove the hostname, or make the appropriate correction.
189+
190+
Alerts and administrator invitations sent via email are less likely to fail SPF or DMARC checks if the system email address is configured in a way the email service provider expects. If the email service provider sends emails which fail SPF and DMARC checks, mail delivery can be delayed or miscategorized as spam.
191+
192+
193+
## (Optional) Perform a complete teardown
194+
195+
When no longer needed, you can delete the resource group to remove all the related resources used to create the Landscape Server VM.
196+
197+
To check the resources in the `Landscape-rg` resource group, run:
198+
```
199+
az resource list --resource-group Landscape-rg --output table
200+
```
201+
202+
To delete the resource group, run:
203+
```
204+
az group delete --name Landscape-rg
205+
```

0 commit comments

Comments
 (0)