Skip to content

Instantly share code, notes, and snippets.

View mikepfeiffer's full-sized avatar
🏠
Working from home

Mike Pfeiffer mikepfeiffer

🏠
Working from home
View GitHub Profile
#!/bin/bash
# Tutorial: Install a LAMP web server on the Amazon Linux AMI
# https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html
# ensure that all of your software packages are up to date
sudo yum update -y
# install related dependencies
sudo yum install -y httpd24 php72 mysql57-server php72-mysqlnd
@mikepfeiffer
mikepfeiffer / wordpress-linux-azure.sh
Last active November 1, 2023 10:44
Build a Standalone Wordpress LAMP Server on Azure
#!/bin/bash
# Tutorial: Install a LAMP stack on an Azure Linux VM
# https://docs.microsoft.com/en-us/azure/virtual-machines/linux/tutorial-lamp-stack
# Create the VM Resource Group
az group create --name LAMP-STACK-RG --location westus2
# Create the VM
az vm create \
@mikepfeiffer
mikepfeiffer / acrTask.sh
Created November 12, 2020 13:09
Create ACR Task to Build Docker Image on GitHub Commit
az acr task create -t node-demo:{{.Run.ID}} -n node-demo -r <acr name> \
-f Dockerfile -c https://github.com/mikepfeiffer/node-docker-demo.git \
--pull-request-trigger-enabled true \
--git-access-token <token>
@mikepfeiffer
mikepfeiffer / CreateWebApp.ps1
Last active March 12, 2024 22:40
Create App Service via Azure PowerShell
# Create variables
$webappname = "mywebapp$(Get-Random)"
$rgname = 'webapps3-dev-rg'
$location = 'westus2'
# Create a resource group
New-AzResourceGroup -Name $rgname -Location $location
# Create an App Service plan in S1 tier
New-AzAppServicePlan -Name $webappname -Location $location -ResourceGroupName $rgname -Tier S1
@mikepfeiffer
mikepfeiffer / gist:7a3a8d12a42ec705233ceee3f3844a35
Last active March 12, 2024 22:40
Create App Service via Azure CLI
az group create -n webapps-dev-rg -l westus2
az appservice plan create --name webapps-dev-plan \
--resource-group webapps-dev-rg \
--sku s1 \
--is-linux
az webapp create -g webapps-dev-rg \
-p webapps-dev-plan \
-n mp10344884 \
@mikepfeiffer
mikepfeiffer / gist:53453a98d62991dfdb5da40beb6229d5
Created April 27, 2020 12:08
PowerShell Script to Create Azure Custom RBAC Role
CD $HOME
wget https://gist.github.com/mikepfeiffer/176776a8758b4e2910554a5c33392c12/raw/e48369b8aa73348606e76cbebc603d9e89c56666/customRoleDefinition.json
$subscription_id = (Get-AzContext).Subscription.id
(Get-Content -Path $HOME/customRoleDefinition.json) -Replace 'SUBSCRIPTION_ID', $subscription_id |
Set-Content -Path $HOME/customRoleDefinition.json
New-AzRoleDefinition -InputFile ./customRoleDefinition.json
@mikepfeiffer
mikepfeiffer / customRoleDefinition.json
Created April 27, 2020 12:01
Custom Role Definition (Azure RBAC)
{
"Name": "Virtual Machine Operator (Custom)",
"Id": null,
"IsCustom": true,
"Description": "Allows to start and stop (deallocate) Azure VMs",
"Actions": [
"Microsoft.Compute/*/read",
"Microsoft.Compute/virtualMachines/deallocate/action",
"Microsoft.Compute/virtualMachines/start/action"
],
@mikepfeiffer
mikepfeiffer / gist:b6687e359d6c0c2562f6574e7a524dd8
Created April 21, 2020 18:16
cloud-init for Azure Linux VM
#cloud-config
package_upgrade: true
packages:
- httpd
@mikepfeiffer
mikepfeiffer / New-LabUser.ps1
Created April 15, 2020 20:41
This function creates AD users intended for lab use.
[CmdletBinding()]
param(
[Parameter(Position=0, Mandatory=$false)]
[System.Int32]
$count = 1,
[Parameter(Position=2, Mandatory=$true)]
[System.String]
$Password,
@mikepfeiffer
mikepfeiffer / NewWebServer.ps1
Created March 9, 2020 18:41
Quick AZ PowerShell Script to Create a Web Server
param(
$Name = 'WEB1',
$Location = 'westus2',
$ResourceGroup = 'WebServers'
)
New-AzResourceGroup -Name $ResourceGroup -Location $Location
$params = @{
Name = $Name