Skip to content

Instantly share code, notes, and snippets.

View weeyin83's full-sized avatar

Sarah Lean weeyin83

View GitHub Profile
@weeyin83
weeyin83 / resources.md
Last active November 20, 2019 11:45
Deliver value within Azure without spending a penny!
@weeyin83
weeyin83 / CreateServicePrincipal.ps1
Created January 3, 2020 09:58
Create an Azure Service Principal in PowerShell
# Create the Service Principal, generates a random password
$sp = New-AzADServicePrincipal -DisplayName ServicePrincipalName
# Export the random password that was generated on creation
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($sp.Secret)
$UnsecureSecret = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
$UnsecureSecret
@weeyin83
weeyin83 / CreateServicePrincipal.sh
Last active January 3, 2020 11:03
Create an Azure Service Principal via Azure CLI
az ad sp create-for-rbac --name ServicePrincipalDisplayName
@weeyin83
weeyin83 / CreateServicePrincipalCustomRole.ps1
Created January 3, 2020 11:04
Create an Azure Service Principal with Contributor access to a single resource group
# Create the Service Principal, generates a random password, grants the Service Principal Contributor access to only a single resource group
$sp = New-AzADServicePrincipal -DisplayName ServicePrincipalName -Role Contributor -Scope /subscriptions/zzzzzzzz-zzzz-zzzz-zzzz-zzzzzzzzzzzz/resourceGroups/myResourceGroup
# Export the random password that was generated on creation
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($sp.Secret)
$UnsecureSecret = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
$UnsecureSecret
@weeyin83
weeyin83 / GitHubActionsVMCreations.ps1
Created January 6, 2020 08:46
This script will deploy a virtual machine within Azure utilising GitHub Actions as the deployment technology.
<#
.SYNOPSIS
Deploys a virtual machine in Azure using GitHub Actions
.DESCRIPTION
This script will deploy a virtual machine within Azure utilising GitHub Actions as the deployment technology.
.OUTPUTS
@weeyin83
weeyin83 / GitHubActionWorkflowtoCreateVM.yml
Created January 6, 2020 10:11
Example workflow that can be used to create a VM in Azure
name: GitHub for IT Pro CI/CD Pipeline
env:
OUTPUT_PATH: ${{ github.workspace }}
on: [push]
jobs:
# Deploy VM in Azure
@weeyin83
weeyin83 / SmokeTest.sh
Last active January 17, 2020 11:36
Create an Azure Resource Group, create a free App Service Plan and create a Web App.
#Create a Resource Group called "rg-smoketest" within the East US region
az group create --name rg-smoketest --location "East US" --tags 'Usage=Test'
#Create an Azure App Service Plan called SmokeTestASP within the rg-smoketest Resource Group and use the Free tier
az appservice plan create --name SmokeTestASP --resource-group rg-smoketest --sku FREE --tags 'Usage=Test'
#Create an Azure Web App called smoke-test app within the rg-smoketest resource group and attach it to the SmokeTestASP plan
az webapp create --name smoketest-web --resource-group rg-smoketest --plan SmokeTestASP
@weeyin83
weeyin83 / speakinglog-databasesetup.sql
Last active June 20, 2022 10:44
Setup the SQL database for my Speaking Reports - https://techielass.com/speaking-reports
/****** Set database settings ******/
ALTER DATABASE [SpeakingLogs] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [SpeakingLogs] SET ANSI_NULLS OFF
GO
ALTER DATABASE [SpeakingLogs] SET ANSI_PADDING OFF
GO
ALTER DATABASE [SpeakingLogs] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [SpeakingLogs] SET ARITHABORT OFF
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SpeakingLogs](
[LogId] [int] IDENTITY(1,1) NOT NULL,
[TalkDate] [date] NOT NULL,
[EventName] [varchar](255) NOT NULL,
[City] [varchar](255) NULL,
[Country] [varchar](255) NULL,