Skip to content

Instantly share code, notes, and snippets.

@bureado
Last active March 10, 2019 00:59
Show Gist options
  • Save bureado/ff42e1c612a71a6fcd940a19845ef051 to your computer and use it in GitHub Desktop.
Save bureado/ff42e1c612a71a6fcd940a19845ef051 to your computer and use it in GitHub Desktop.
Deploys Photon OS 3.0 GA in Azure
#!/bin/sh
#
# This script deploys a custom Photon 3.0 GA VHD to Azure and starts a VM
# See https://dev.to/bureado/getting-started-with-photon-os-on-azure-32h8 for more.
#
# Usage: ./script.sh photon.vhd
#
set -x
set -e
# Adjust as needed (STORAGE needs to be globally unique)
GROUP=photon-rg
STORAGE=phrg999
LOCATION=southcentralus
VM_NAME=photon-vm
# Optional settings
STORAGE_CONTAINER=vhds
IMAGE_PATH=$1
IMAGE_NAME=`basename $IMAGE_PATH`
# Create the workspaces
az group create -n $GROUP -l $LOCATION
az storage account create -n $STORAGE -g $GROUP
CONNST=`az storage account show-connection-string -o tsv -n $STORAGE -g $GROUP`
az storage container create --connection-string $CONNST --name $STORAGE_CONTAINER
# Upload VHD
az storage blob upload --connection-string $CONNST --name $IMAGE_NAME --file $IMAGE_PATH --container $STORAGE_CONTAINER
# Create VM
az vm create -n $VM_NAME -g $GROUP --os-type linux --image https://$STORAGE.blob.core.windows.net/$STORAGE_CONTAINER/$IMAGE_NAME --use-unmanaged-disk --storage-account $STORAGE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment