Wednesday, September 18, 2024

Setup FreePBX (AND Asterisk) in AZURE

This pretty much will work for any deployment I guess, but this is specifically written for AZURE, so there might be some tweaks in here that are specific for that environment.  This deployment was done via a Windows 10 machine.


In Azure, create a new virtual machine.

In my example i'm using a "PAY AS YOU GO" approach and have assigned it to a group called pbxtest1


I assigned it a virtual machine name and region


At time of writing this, the FreePBX deployment recommends Debian 12 "Bookworm"

Assign it with the appropriate CPU and RAM that you will need.  For testing, I'm using a minimal system



I'm leaving everything else default.  Select Review and Create

Select "CREATE" on the subsequent page, then you will be prompted "Generate new key Pair"

Download the private key


Your system should download the key file



Azure should start building your deployment


That will only take a few minutes to create normally.

Select "Go To Resource"


Note the IP address assigned to your instance


If you haven't already, install PUTTY from putty.org


Launch the APP " PuttyGEN


Select "CONVERSION" -> IMPORT KEY



Select the key file that you downloaded upon creation of the machine



Now select "FILE" -> "Save Private Key"


You'll get a PuttyGen warning about saving it without a passphrase, select YES


Give it a name and select SAVE


You can close the PuttyGEN app

Now open a regular PUTTY session


Enter in the IP provided to you by Azure.  Give it a name under "Saved Sessions"


Select "SSH" -> Auth -> Credentials to Authenticate with



In the Public-key authentication select  BROWSE and open up the key file you generated in PuttyGen



Scroll back up to "SESSION" then click on "SAVE

Now open your saved session.  If it works, you should get prompted with the similar security warning




Select "ACCEPT"

Logon with the default user " azureuser "

Should be prompted with something like this:


Lets update the system first (will take a few minutes depending on network and guest speed

sudo apt update && sudo apt upgrade -y

Now run the following to enter ROOT

sudo -i

Get the latest updates 

#################################################################################

The following command will install the latest release of FreePBX (at time of writing version 17) and the lastest GA of Aasterisk

cd /tmp

wget https://github.com/FreePBX/sng_freepbx_debian_install/raw/master/sng_freepbx_debian_install.sh  -O /tmp/sng_freepbx_debian_install.sh

bash /tmp/sng_freepbx_debian_install.sh

The script will now do a full install of all the necessary items to get FreePBX and Asterisk up and running.  Will take about 30 minutes

Will be something like this as you wait..

When all said and done, assuming no installation issues, you should be presented with this screen similar.


Goto your guest network settings:  
select "Create Port Rule"
then select InBound Port Rule

Create a rule with the service as HTTP.  You can use all the other default settings



Click on ADD

You should now be able to HTTP to the WAN IP that you used to SSH to the box.

And be presented with a screen like this:



Fill in the user name and email address that you want to logon to the system with and receive system status message in the future.

You have to change the System Identification name from the default provide to something new to continue.