Last active
March 10, 2019 00:59
Star
You must be signed in to star a gist
Deploys Photon OS 3.0 GA in Azure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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