Reply
Member
Posts: 107
Registered: ‎09-17-2014
Kudos: 45
Solutions: 4

Unifi Controller on Azure

[ Edited ]

I've documented how to create a Unifi Controller on AWS and GCP, so though I would do Azure as well.  

*Update* Azure now has a Free Account option for 12 months

https://azure.microsoft.com/en-us/free/free-account-faq/

 

Note: Azure's interface changes daily, so these instructions may not completely match the current interface.

At this time, Azure uses Ubuntu 16.04 as the TLS version.

 

  1. Create an Azure account and login to the portal website
    1. https://portal.azure.com
  2. Open the Azure Cloud Shell by clicking on the >_ icon at the top of the page AzureCloudShell2.JPG
  3. When/If prompted, select the Bash (Linux) option
    Bash.JPG
  4. The first time you enter th eAzure Cloud Shell, you will be prompted to setup storage, which you can accept the default or change Advanced options if desired
    3-Storage.JPG
  5. The following commands will create a Resource Group named Unifi-RG to hold all related components, create Network Security Group (Firewall) rules for the controller, and then provision a VM with a static IP and the NSG rules
    az group create --name Unifi-RG --location EastUS
    
    az network nsg create --resource-group Unifi-RG --name Unifi-Controller-NSG
    az network nsg rule create --resource-group Unifi-RG --nsg-name Unifi-Controller-NSG --name unifi-http --protocol tcp --priority 1000 --destination-port-ranges 80 8443 8880 8843 --access allow
    az network nsg rule create --resource-group Unifi-RG --nsg-name Unifi-Controller-NSG --name unifi-inform --protocol tcp --priority 1001 --destination-port-ranges 8080 --access allow
    az network nsg rule create --resource-group Unifi-RG --nsg-name Unifi-Controller-NSG --name unifi-stun --protocol udp --priority 1002 --destination-port-ranges 3478 --access allow
    az network nsg rule create --resource-group Unifi-RG --nsg-name Unifi-Controller-NSG --name unifi-throughput --protocol tcp --priority 1003 --destination-port-ranges 6789 --access allow
    az network nsg rule create --resource-group Unifi-RG --nsg-name Unifi-Controller-NSG --name ssh --protocol tcp --priority 1004 --destination-port-ranges 22 --access allow
    
    az vm create --resource-group Unifi-RG \
    --name unifi-controller \
    --location EastUS \
    --image UbuntuLTS \
    --generate-ssh-keys \
    --size Standard_B1s \
    --nsg Unifi-Controller-NSG \
    --public-ip-address-allocation static
  6. Once the VM is created, take note of the public IP address, using the GUI or the following command in the Cloud Shell
    az network public-ip list -g Unifi-RG | grep ipAddress
  7. Connect to the VM using SSH in the Cloud Shell to install the Unifi software, using the great scripts from Glennr found here: https://community.ubnt.com/t5/UniFi-Wireless/UniFi-Installation-Scripts-UniFi-Easy-Update-Scripts-Wo...
    As new versions are released, update the link and file name as needed.
    ssh PublicIPAddressHere
    wget https://get.glennr.nl/unifi/5.8.30/U1604/unifi-5.8.30.sh  && chmod +x unifi-5.8.30.sh
    sudo ./unifi-5.8.30.sh
  8. Once the script has completed, open a web browser to public IP address to complete the configuration or restore from your backup file.
Senior Member
Posts: 13,055
Registered: ‎08-04-2017
Kudos: 2217
Solutions: 640

Re: Unifi Controller on Azure

[ Edited ]

Hello @MallocArray,

 

Awesome to see that you're using my scripts!

 

 

Regards,

Glenn R.

Cloud Hosted Controllers | Glenn R. | UniFi Installation/Easy Update Scripts | UniFi-Video Installation/Easy Update Scripts | UniFi-VoIP Installation Scripts
USG-4-PRO • USG
USW-48-500W • USW-24-POE-250W 2x • USW-16-POE-150W 3x • USW-24 • USW-8-150W • USW-8
UAP XG • UAP-SHD • UAP-HD • UAP-NanoHD • UAP-AC-PRO 2x • UAP-AC-LITE • UAP-AC-IW • UAP-AC-M
UCK-G2-PLUS • UCK-G2 • UCK
New Member
Posts: 1
Registered: ‎10-11-2018
Kudos: 1

Re: Unifi Controller on Azure

This is great

 

Can anyone advise what commands would be used to upgrade to the latest version? For example 5.9.29

 

Thanks

Emerging Member
Posts: 80
Registered: ‎04-07-2017
Kudos: 16
Solutions: 2

Re: Unifi Controller on Azure

[ Edited ]

@clarion-ccit wrote:

This is great

 

Can anyone advise what commands would be used to upgrade to the latest version? For example 5.9.29

 

Thanks


On Ubuntu, regardless of where it is hosted:

 

sudo apt-get update
sudo apt-get upgrade unifi

Personally, I prefer to patch the OS as well.  This does not upgrade you to the latest version of Ubuntu (i.e. if you're on 16.04, you'll stay on 16.04):

 

sudo apt-get update
sudo apt-get upgrade

 

Senior Member
Posts: 13,055
Registered: ‎08-04-2017
Kudos: 2217
Solutions: 640

Re: Unifi Controller on Azure

[ Edited ]

Hello @clarion-ccit,

 

You can use my easy update script. (Scroll down till you see the easy update banner)

 

 

Regards,

Glenn R.

Cloud Hosted Controllers | Glenn R. | UniFi Installation/Easy Update Scripts | UniFi-Video Installation/Easy Update Scripts | UniFi-VoIP Installation Scripts
USG-4-PRO • USG
USW-48-500W • USW-24-POE-250W 2x • USW-16-POE-150W 3x • USW-24 • USW-8-150W • USW-8
UAP XG • UAP-SHD • UAP-HD • UAP-NanoHD • UAP-AC-PRO 2x • UAP-AC-LITE • UAP-AC-IW • UAP-AC-M
UCK-G2-PLUS • UCK-G2 • UCK
Emerging Member
Posts: 80
Registered: ‎04-07-2017
Kudos: 16
Solutions: 2

Re: Unifi Controller on Azure

@AmazedMender16 Thanks, but as I said, I also patch the OS.  I have an alias that I can run from my shell to do that.

Senior Member
Posts: 13,055
Registered: ‎08-04-2017
Kudos: 2217
Solutions: 640

Re: Unifi Controller on Azure

Hello @belvdr,

 

Sorry tagged the wrong user, your commands only work if you have the repository on your machine.

 

 

Regards,

Glenn R.

Cloud Hosted Controllers | Glenn R. | UniFi Installation/Easy Update Scripts | UniFi-Video Installation/Easy Update Scripts | UniFi-VoIP Installation Scripts
USG-4-PRO • USG
USW-48-500W • USW-24-POE-250W 2x • USW-16-POE-150W 3x • USW-24 • USW-8-150W • USW-8
UAP XG • UAP-SHD • UAP-HD • UAP-NanoHD • UAP-AC-PRO 2x • UAP-AC-LITE • UAP-AC-IW • UAP-AC-M
UCK-G2-PLUS • UCK-G2 • UCK
New Member
Posts: 4
Registered: ‎10-31-2017
Kudos: 1

Re: Unifi Controller on Azure

This worked perfectly! Thanks for Sharing!
New Member
Posts: 25
Registered: ‎12-11-2018
Solutions: 1

Re: Unifi Controller on Azure

Can a Cloud-based Controller like this be configured to manage multiple clients using their own Captive Portals? I'm looking for a multi-tennant hosted solution.

 

Right now, I've created my own Index.html that is redirecting to a Captive Portal page running on my Server. It's then passing in the Mac Address of the device etc.... along with an AppId that is linked to my customer.

 

The Index.html file is here.

C:\Users\USERNAME\Ubiquiti UniFi\data\sites\default\portal

 

Currently, this page is hosted on a local computer running the Controll software or on a Unifi Cloud Key.

 

Any help is much appreciated! Thanks in advance!

Senior Member
Posts: 13,055
Registered: ‎08-04-2017
Kudos: 2217
Solutions: 640

Re: Unifi Controller on Azure

Hello @dumber_texan2,

 

Welcome to the community!

 

Yes you can create a guuest portal per site.

 

 

Regards,

Glenn R.

Cloud Hosted Controllers | Glenn R. | UniFi Installation/Easy Update Scripts | UniFi-Video Installation/Easy Update Scripts | UniFi-VoIP Installation Scripts
USG-4-PRO • USG
USW-48-500W • USW-24-POE-250W 2x • USW-16-POE-150W 3x • USW-24 • USW-8-150W • USW-8
UAP XG • UAP-SHD • UAP-HD • UAP-NanoHD • UAP-AC-PRO 2x • UAP-AC-LITE • UAP-AC-IW • UAP-AC-M
UCK-G2-PLUS • UCK-G2 • UCK
New Member
Posts: 25
Registered: ‎12-11-2018
Solutions: 1

Re: Unifi Controller on Azure

Good to know! Does it create it's own Directory on the Server, per site? Is this how I can configure at unique Index.html page, per Site? I guess I would then use FTP to upload a new file.

 

Thanks in advance!

Senior Member
Posts: 13,055
Registered: ‎08-04-2017
Kudos: 2217
Solutions: 640

Re: Unifi Controller on Azure

Hello @dumber_texan2,

 

Yes each site has it's own directory.

 

 

Regards,

Glenn R.

Cloud Hosted Controllers | Glenn R. | UniFi Installation/Easy Update Scripts | UniFi-Video Installation/Easy Update Scripts | UniFi-VoIP Installation Scripts
USG-4-PRO • USG
USW-48-500W • USW-24-POE-250W 2x • USW-16-POE-150W 3x • USW-24 • USW-8-150W • USW-8
UAP XG • UAP-SHD • UAP-HD • UAP-NanoHD • UAP-AC-PRO 2x • UAP-AC-LITE • UAP-AC-IW • UAP-AC-M
UCK-G2-PLUS • UCK-G2 • UCK
New Member
Posts: 25
Registered: ‎12-11-2018
Solutions: 1

Re: Unifi Controller on Azure

What happens if the Controller is down or unreachable? I assume people would not be able to access the Wi-Fi Network. Is this correct? If not, please explain. Thanks!

Senior Member
Posts: 13,055
Registered: ‎08-04-2017
Kudos: 2217
Solutions: 640

Re: Unifi Controller on Azure

[ Edited ]

Hello @dumber_texan2,

 

Last time I checked this locally they were able to access the internet without authorizing via the controller.

I do recommend creating your own thread though, you can tag me.

 

 

Regards,

Glenn R.

Cloud Hosted Controllers | Glenn R. | UniFi Installation/Easy Update Scripts | UniFi-Video Installation/Easy Update Scripts | UniFi-VoIP Installation Scripts
USG-4-PRO • USG
USW-48-500W • USW-24-POE-250W 2x • USW-16-POE-150W 3x • USW-24 • USW-8-150W • USW-8
UAP XG • UAP-SHD • UAP-HD • UAP-NanoHD • UAP-AC-PRO 2x • UAP-AC-LITE • UAP-AC-IW • UAP-AC-M
UCK-G2-PLUS • UCK-G2 • UCK
Member
Posts: 107
Registered: ‎09-17-2014
Kudos: 45
Solutions: 4

Re: Unifi Controller on Azure

If using the guest portal and the controller is down, then no new authentications can happen.

 

If not using a guest portal, devices can still connect with the existing passwords.

 

For further questions, it would be best to start a new thread, as this is not directly related to running the controller in Azure.

Highlighted
New Member
Posts: 25
Registered: ‎12-11-2018
Solutions: 1

Re: Unifi Controller on Azure

Thanks, will do.

New Member
Posts: 25
Registered: ‎12-11-2018
Solutions: 1

Re: Unifi Controller on Azure

I was able to install version 5.6 of the Controller and my AP is Connected. Now, I'm having a problem with directory permissions when trying to access the files for the Captive Portal.
 
I can't access the /data directory here. I get this error.
/usr/lib/unifi/data/sites/[SITE NAME]/portal/
-bash: cd: data: Permission denied
 
If I try to access the /unifi directory here, I get this error.
/var/lib/unifi/sites
-bash: cd: unifi: Permission denied
 
I used this guys instructions to configure my Azure FTP Server.http://techcater.com/configure-ftp-server-azure-ubuntu-vm/
 
Here is some good information on how Azure setups Ubuntu VMs when it comes to an Admin user and access.https://mohitgoyal.co/2017/08/21/become-root-user-on-linux-servers-in-azure/
 
I assume I need to somehow give my Admin user access to these folders. but I'm not a Linux guy.
 
Any help is much appreciated! Thanks!
Senior Member
Posts: 13,055
Registered: ‎08-04-2017
Kudos: 2217
Solutions: 640

Re: Unifi Controller on Azure

Hello @dumber_texan2,

 

Use the root user.

 

 

Regards,

Glenn R.

Cloud Hosted Controllers | Glenn R. | UniFi Installation/Easy Update Scripts | UniFi-Video Installation/Easy Update Scripts | UniFi-VoIP Installation Scripts
USG-4-PRO • USG
USW-48-500W • USW-24-POE-250W 2x • USW-16-POE-150W 3x • USW-24 • USW-8-150W • USW-8
UAP XG • UAP-SHD • UAP-HD • UAP-NanoHD • UAP-AC-PRO 2x • UAP-AC-LITE • UAP-AC-IW • UAP-AC-M
UCK-G2-PLUS • UCK-G2 • UCK
New Member
Posts: 25
Registered: ‎12-11-2018
Solutions: 1

Re: Unifi Controller on Azure

I don't beleive Azure gives access to root. I also don't see how I could use root with FTP, especially seeing as Azure doesn't allow you to use the root user.

 

Any other ideas?  Thanks!

Senior Member
Posts: 13,055
Registered: ‎08-04-2017
Kudos: 2217
Solutions: 640

Re: Unifi Controller on Azure

Hello @dumber_texan2,

 

You can enable the root accouunt yourself.

Have you tried using SFTP?


I recommend creating your own thread.

 

 

Regards,

Glenn R.

Cloud Hosted Controllers | Glenn R. | UniFi Installation/Easy Update Scripts | UniFi-Video Installation/Easy Update Scripts | UniFi-VoIP Installation Scripts
USG-4-PRO • USG
USW-48-500W • USW-24-POE-250W 2x • USW-16-POE-150W 3x • USW-24 • USW-8-150W • USW-8
UAP XG • UAP-SHD • UAP-HD • UAP-NanoHD • UAP-AC-PRO 2x • UAP-AC-LITE • UAP-AC-IW • UAP-AC-M
UCK-G2-PLUS • UCK-G2 • UCK
Reply