Deploying on Azure
We will be using Microsoft Azure to host our web applications. Azure provides virtual machines, on which we will build Linux servers, as well as a number of other web application hosting services.
Creating Your Account
You can log in to Azure using your NetID and password, or with a Microsoft account.
I will be sending you an e-mail with your Azure code; to activate it on your account, visit http://www.microsoftazurepass.com. You will need to log in and provide your Azure pass code.
To log in with your NetID and password, choose ‘Log in with work or school account’, enter your Texas State e-mail address (
firstname.lastname@example.org) in the e-mail field, and hit Tab. This will then send you to a Texas State login page, after which you can proceed.
Creating a VM
Configuring a complete virtual machine and all its pieces is a little bit complicated. I have created a template that, when used, will create an Azure resource group containing a virtual machine running Debian, all the other Azure pieces required in order to make that VM work, and Python and web server packages installed on the Debian server. When it's done, it will be ready for you to connect to (via SSH), create a virtual environment, and run your Flask applications.
The button below will create a new VM with the template. This process will prompt you for a few parameters:
- AdminUserName — the username for your admin account on the new VM.
- AdminPassword — the password for this account.
- DNSNameForPublicIP — the name of the VM as you will connect to it. I recommend including both
cs3320and a unique name, such as your Net ID, in it. It can contain letters, numbers, and hyphens.
- InstanceSize — the size of the virtual machine. A0 is sufficient for most of our purposes.
In addition, you can select or create a resource group to contain the resulting server, and select a location (if you are creating a new resource group).
Finally, you will need to review the legal terms before it will allow you to create the VM.
If you use the DNS name
foo and the location South Central US, then your server will be available as
Once your deployment has completed (it will take some time, possibly as long as 15–30 minutes), you can connect to your server via SSH (using
ssh on OS X or Linux, or PuTTY on Windows; see software).
Setting Up SSL
Once you have your VM installed, you need to enable SSL. We can do this for free thanks to Let's Encrypt.
To set up an SSL certificate, run the following command:
sudo letsencrypt run --apache
If you do not have a
letsencrypt command, install it with
sudo apt-get install -t jessie-backports letsencrypt python-letsencrypt-apache
It will give you a warning about not having any
ServerNames defined; that is fine, we can proceed anyway.
Enter the full public DNS name of your VM in the prompt for server name.
If you use the DNS name
foo when you create your VM, and the location South Central US, then your server will be available as
Enter your e-mail address (this may be public).
Select either ‘Easy’ or ‘Secure’. For our games and such, Secure is likely the best idea.
That's it! There is an ‘accept agreement’ step in there, and it will automatically do the following:
- Create an SSL key and certificate
- Set up ‘proof of ownership’ of your DNS name
- Submit the certificate to Lets Encrypt for signing
- Install the resulting key and certificate in Apache
If you would like to create additional user accounts for your team members, do the following:
sudo useradd -m -G sudo bob sudo passwd bob
That will add a user,
bob, and give them permission to run
sudo, and finally set a password for them.