Skip to content

Instantly share code, notes, and snippets.

Working from home

Mike Pfeiffer mikepfeiffer

Working from home
View GitHub Profile
mikepfeiffer /
Created Nov 12, 2020
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 \
--pull-request-trigger-enabled true \
--git-access-token <token>
mikepfeiffer / CreateWebApp.ps1
Last active Nov 7, 2021
Create App Service via Azure PowerShell
View CreateWebApp.ps1
# 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 / gist:7a3a8d12a42ec705233ceee3f3844a35
Last active Oct 27, 2021
Create App Service via Azure CLI
View gist:7a3a8d12a42ec705233ceee3f3844a35
az group create -n webapps-dev-rg -l westus2
az appservice plan create --name webapps-dev-plan \
--resource-group webapps-dev-rg \
--sku s1 \
az webapp create -g webapps-dev-rg \
-p webapps-dev-plan \
-n mp10344884 \
mikepfeiffer / gist:53453a98d62991dfdb5da40beb6229d5
Created Apr 27, 2020
PowerShell Script to Create Azure Custom RBAC Role
View gist:53453a98d62991dfdb5da40beb6229d5
$subscription_id = (Get-AzContext)
(Get-Content -Path $HOME/customRoleDefinition.json) -Replace 'SUBSCRIPTION_ID', $subscription_id |
Set-Content -Path $HOME/customRoleDefinition.json
New-AzRoleDefinition -InputFile ./customRoleDefinition.json
mikepfeiffer / customRoleDefinition.json
Created Apr 27, 2020
Custom Role Definition (Azure RBAC)
View customRoleDefinition.json
"Name": "Virtual Machine Operator (Custom)",
"Id": null,
"IsCustom": true,
"Description": "Allows to start and stop (deallocate) Azure VMs",
"Actions": [
View gist:b6687e359d6c0c2562f6574e7a524dd8
package_upgrade: true
- httpd
mikepfeiffer / New-LabUser.ps1
Created Apr 15, 2020
This function creates AD users intended for lab use.
View New-LabUser.ps1
[Parameter(Position=0, Mandatory=$false)]
$count = 1,
[Parameter(Position=2, Mandatory=$true)]
mikepfeiffer / NewWebServer.ps1
Created Mar 9, 2020
Quick AZ PowerShell Script to Create a Web Server
View NewWebServer.ps1
$Name = 'WEB1',
$Location = 'westus2',
$ResourceGroup = 'WebServers'
New-AzResourceGroup -Name $ResourceGroup -Location $Location
$params = @{
Name = $Name
mikepfeiffer /
Created Mar 8, 2020
Quick Azure CLI script to create a Windows VM
az group create --name WebServers --location westus2
az vm create \
--resource-group WebServers \
--name WEB1 \
--image win2016datacenter \
--admin-username sysadmin \
--size Standard_DS2_v2
mikepfeiffer / utils.ps1
Last active Nov 21, 2021
PS Function that creates an Azure Service Principal
View utils.ps1
function New-Sp {
param($Name, $Password)
$spParams = @{
StartDate = Get-Date
EndDate = Get-Date -Year 2030
Password = $Password
$cred= New-Object Microsoft.Azure.Commands.ActiveDirectory.PSADPasswordCredential -Property $spParams