Skip to content

Instantly share code, notes, and snippets.

@kevinhillinger
kevinhillinger / create-service.sh
Last active September 25, 2019 17:46
Azure Meta Service Broker - Redis Cache Premium - PCF
# created the service broker via command
SECURITY_USER_NAME=<username>
SECURITY_USER_PASSWORD=<the password>
URL=http://meta-azure-service-broker.<public ip value here>.xip.io
cf create-service-broker meta-azure-service-broker $SECURITY_USER_NAME $SECURITY_USER_PASSWORD $URL
# enabled service for redis
cf enable-service-access azure-rediscache
@kevinhillinger
kevinhillinger / assign-user-to-access-kubeconfig.sh
Last active June 12, 2019 20:07
Azure AD Integration with AKS
# The following example assigns the Azure Kubernetes Service Cluster Admin Role to an individual user account.
# This is controlled via Azure AD -> Azure AKS (separate from AAD integration with
# AKS where someone can assign a user a cluster role
# Get the resource ID of your AKS cluster
AKS_CLUSTER=$(az aks show --resource-group myResourceGroup --name myAKSCluster --query id -o tsv)
# Get the account credentials for the logged in user
ACCOUNT_UPN=$(az account show --query user.name -o tsv)
@kevinhillinger
kevinhillinger / iis-prepull.yaml
Last active June 11, 2019 14:55
Pre-pulling base images using Windows Containers on AKS
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: prepull
spec:
selector:
matchLabels:
name: prepull
template:
metadata:
@kevinhillinger
kevinhillinger / azure-pipelines.yaml
Created June 5, 2019 18:48
Deploy container to Azure Container Registry from Azure DevOps
# Docker
# Build and push an image to Azure Container Registry
# https://docs.microsoft.com/azure/devops/pipelines/languages/docker
trigger:
- master
resources:
- repo: self
@kevinhillinger
kevinhillinger / deploy.sh
Last active June 11, 2019 19:58
AKS Cluster with Windows Containers, Custom Virtual Network (VNet) with CNI
# get list of nodes
kubectl get nodes
# beta.kubernetes.io/os=windows
# taint
nodes=$(kubectl get no \
-o jsonpath="{.items[*].metadata.name}" \
-l=beta.kubernetes.io/os=windows)
@kevinhillinger
kevinhillinger / 1-setup-resources.sh
Last active April 1, 2019 19:16
Azure API Management to Key Vault Integration - Client Certificate Authentication
rg=apim
location=eastus2
vnet=apim-vnet
az group create --name $rg --location $location
az network vnet create -n $vnet -g $rg -l $location \
--address-prefixes 10.0.0.0/16 \
--subnet-name default \
--subnet-prefixes 10.0.0.0/24
@kevinhillinger
kevinhillinger / create_managed_disk_from_vmss_snapshot.ps1
Created March 18, 2019 12:38
Snapshot a VM Scale Set instance and create a managed disk from it
$resourceGroupName = "myResourceGroup"
$scalesetName = "myVMScaleSet"
$vmInstanceId = 0
$location = "eastus2"
$snapshotName = "vmss_snapshot"
# create the snapshot
$vmss = Get-AzVmssVM -ResourceGroupName $resourceGroupName -VMScaleSetName $scalesetName -InstanceId $vmInstanceId
@kevinhillinger
kevinhillinger / add-log-analytics-ext-arm-tmpl.json
Last active March 28, 2019 16:12
Adding Log Analytics VM Extension to VM Scale Set with PowerShell
{
"name": "[concat(variables('vmNodeType0Name'),'OMS')]",
"properties": {
"publisher": "Microsoft.EnterpriseCloud.Monitoring",
"type": "MicrosoftMonitoringAgent",
"typeHandlerVersion": "1.0",
"autoUpgradeMinorVersion": true,
"settings": {
"workspaceId": "[reference(resourceId('Microsoft.OperationalInsights/workspaces/', parameters('omsWorkspacename')), '2015-11-01-preview').customerId]"
@kevinhillinger
kevinhillinger / ServiceManifest.xml
Last active February 19, 2019 15:04
Service Fabric - UDP Service
// sourced: https://stackoverflow.com/questions/35902685/service-fabric-stateless-server-custom-udp-listener
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="UdpServicePkg"
Version="1.0.0"
xmlns="http://schemas.microsoft.com/2011/01/fabric"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ServiceTypes>
<!-- This is the name of your ServiceType.
@kevinhillinger
kevinhillinger / vsts_trigger_release.ps1
Created August 3, 2018 17:54
VSTS REST API Authentication & Trigger Release
Param(
[string]$vstsAccount = "<VSTS-ACCOUNT-NAME>",
[string]$projectName = "<PROJECT-NAME>",
[string]$releaseDefinitionId = "<RELEASE-ID>",
[string]$keepForever = "true",
[string]$user = "",
[string]$token = "<PERSONAL-ACCESS-TOKEN>"
)
Write-Verbose "Parameter Values"