DEV Community

José Miguel Parrella
José Miguel Parrella

Posted on

Getting started with Photon OS on Azure

Photon OS is an open source, minimal Linux container host that is optimized for cloud-native applications. On Azure, it ships with just over a hundred packages including systemd, cloud-init and docker but Photon offers over a thousand packages in their repos like Go, .NET Core, Postgres, Tomcat, Zookeeper or Kubernetes!

This is a simplified version of the Azure quickstart experience in the official Photon OS documentation. It was tested with Photon OS 3.0 GA and azure-cli version 2.0.38.


  1. Download the VHD for Azure from GitHub and extract with tar xf in your local system
  2. Ensure you have the latest Azure CLI (az) available in your working system and that you've logged in with az login

Getting started

Just like any other custom Linux VHD, you'll create a few workspaces, upload the VHD and create a new VM based on it.

Here's a script that simplifies the VM creation. It assumes that an SSH keypair is available in the profile of whatever user runs this script. It expects the downloaded and extracted VHD as an argument, for example: ./ photon-azure-3.0-26156e2.vhd:

$ ./ ./photon-azure-3.0-26156e2.vhd                                                      
+ set -e                                                                                                                  
+ GROUP=photon-rg                                                                                                         
+ STORAGE=phrg999                
+ LOCATION=southcentralus                                      
+ VM_NAME=photon-vm                                                           
+ STORAGE_CONTAINER=vhds                                                                                                  
+ IMAGE_PATH=./photon-azure-3.0-26156e2.vhd                                                                               
+ basename ./photon-azure-3.0-26156e2.vhd                                                                                
+ IMAGE_NAME=photon-azure-3.0-26156e2.vhd                                                                                 
+ az group create -n photon-rg -l southcentralus                     
+ az storage account create -n phrg999 -g photon-rg  
+ az vm create -n photon-vm -g photon-rg --os-type linux --image --use-unmanaged-disk --storage-account phrg999                                                             
  "powerState": "VM running",

The az vm create command will output (in JSON, by default) information about the newly created VM, including a public IP address you can use to SSH into the VM. If you missed it, run az vm list-ip-addresses -o table.

bureado@photon4 [ ~ ]$ systemd-analyze 
Startup finished in 1.278s (kernel) + 2.177s (initrd) + 14.546s (userspace) = 18.002s reached after 14.532s in userspace
bureado@photon4 [ ~ ]$ cloud-init --version
/usr/bin/cloud-init 18.3
bureado@photon4 [ ~ ]$ uname -a
Linux photon4 4.19.15-3.ph3 #1-photon SMP Mon Feb 25 14:48:35 UTC 2019 x86_64 GNU/Linux
bureado@photon4 [ ~ ]$ curl -s -H Metadata:true "" | jq .compute.location
bureado@photon4 [ ~ ]$ 

Cleaning up

If you used a unique resource group name in the $GROUP variable above, you can remove all resources by running az group delete -g <group name> --yes. This will remove all resources created by the script, including the uploaded blob, but won't delete it from your local working folder.

Have fun!

Top comments (0)