How to deploy NoPorts on Azure using a cloud-init script
In the Azure Portal select Virtual machines and hit the + Create button.
Choose your preferred options for each sub-page of the Create a virtual machine process.
On the Advanced sub-page there's a Custom data and cloud init section where your customised script can be pasted:
#!/bin/bash# Modify these lines to set the installation specific variablesATCLIENT="@democlient"ATDEVICE="@demodevice"DEVNAME="cloudvm1"OTP="739128"USER="azureuser"# The rest of the script shouldn't be changedexport HOME="/home/${USER}"export SUDO_USER="${USER}"mkdir-p/run/atsigncd/run/atsignVERSION=$(wget -q -O- "https://api.github.com/repos/atsign-foundation/noports/releases/latest" | grep -Po '"tag_name": "v\K.*?(?=")')
wgethttps://github.com/atsign-foundation/noports/releases/download/v${VERSION}/universal.shshuniversal.sh-tdevice-c ${ATCLIENT} -d ${ATDEVICE} -n ${DEVNAME}/usr/local/bin/at_activate enroll -a ${ATDEVICE} -s ${OTP} -p noports -k /home/${USER}/.atsign/keys/${ATDEVICE}_key.atKeys -d ${DEVNAME} -n "sshnp:rw,sshrvd:rw"
chown-R ${USER}:${USER} /home/${USER}/.atsign
It should look like this:
Once that's complete the VM is ready for Review + create then if all looks well hit Create
After a few minutes the APKAM key can be approved:
at_activate approve -a @demodevice --arx noports --drx cloudvm1
If the VM isn't quite ready you'll see:
Found 0 matching enrollment records
No matching enrollment(s) found
Waiting a little longer and retrying should produce a successful approval:
Found 1 matching enrollment records
Approving enrollmentId 0bd3613d-d3e2-45b3-b175-8cab06c9bad0
Server response: AtEnrollmentResponse{enrollmentId: 0bd3613d-d3e2-45b3-b175-8cab06c9bad0, enrollStatus: EnrollmentStatus.approved}
The VM is now ready for connection with the NoPorts client.