Skip to content

Instantly share code, notes, and snippets.

View lukemurraynz's full-sized avatar
☁️
Breaking things!

Luke Murray lukemurraynz

☁️
Breaking things!
View GitHub Profile
@lukemurraynz
lukemurraynz / AzureStaticWebAppsCICD.yml
Created November 14, 2022 00:45
Azure Static Web Apps CI/CD
name: Azure Static Web Apps CI/CD
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main
@lukemurraynz
lukemurraynz / python.sqldb.txt
Last active August 16, 2022 23:24
python.sql.ipynb
#Libraries
import pyodbc
#Connection to SQL database
server = 'tcp:SQLSERVER.database.windows.net'
database = 'DBNAME'
username = 'user@contoso.com'
password = 'password'
//Related to a Blog Article: https://luke.geek.nz for setting up Azure Naming Tool.
///Parameter Setting
param location string = resourceGroup().location
//Adjust Parameter values to match your naming conventions
param serverfarms_AzNamingTool_ASP_Prod_name string = 'AzNamingTool-ASP-Prod'
param storageAccounts_aznamingstgacc_name string = 'aznaming'
// The following Parameters are used add Tags to your deployed resources. Adjust for your own needs.
#requires -Version 3.0 -Modules Az.Accounts, Az.Resources
<#
.SYNOPSIS
PowerShell Azure Automation Runbook for Starting/Stopping Virtual Machines.
.AUTHOR
Luke Murray (https://github.com/lukemurraynz/)
.VERSION
1.0 - 28/04/22 - script versioned to '1.0'.
.DESCRIPTION
1. The script first checks if today is a holiday by making a call to the Abstract API.
@lukemurraynz
lukemurraynz / Deallocate-AzureVirtualMachine.ps1
Last active May 12, 2022 06:12
PowerShell Azure Automation Runbook for Stopping Virtual Machines, that have been Shutdown within the Windows Operating System (Stopped and not Deallocated).
#requires -Version 3.0 -Modules Az.Accounts, Az.AlertsManagement
<#
.SYNOPSIS
PowerShell Azure Automation Runbook for Stopping Virtual Machines, that have been Shutdown within the Windows Operating System (Stopped and not Deallocated).
.AUTHOR
Luke Murray (https://github.com/lukemurraynz/)
#>
[OutputType('PSAzureOperationResponse')]
param (
@lukemurraynz
lukemurraynz / Deploy-AzVNETS2S.bicep
Created March 27, 2022 08:09
Deploy-AzVNETS2S.bicep
targetScope = 'resourceGroup'
///Parameter and Variable Setting
@minLength(3)
@maxLength(6)
param sitecode string = ''
param environment string = ''
param contactEmail string = ''
#requires -Version 1.0
# Variables
#Enter your subscription name
$subscriptionName = 'luke.geek.nz'
#Enter the name of yuour
$policyDisplayName = 'Deploy - Log Analytics' #Cant Exceed 24 characters
$location = 'australiaeast'
$resourceGroup = 'aoegeek-rg'
$UsrIdentityName = 'AOE_ManagedIdentityUsr'
$param = @{
@lukemurraynz
lukemurraynz / azure-pipelines.yml
Created January 7, 2022 09:54
azure-pipelines.yml
# Variable 'location' was defined in the Variables tab
# Variable 'PrimaryDNSZone' was defined in the Variables tab
# Variable 'ResourceGroupName' was defined in the Variables tab
# Variable 'SPN' is defined in the Variables tab
trigger:
branches:
include:
- refs/heads/main
jobs:
- job: Job_1
@lukemurraynz
lukemurraynz / Deploy-PublicDNS.bicep
Last active January 22, 2022 16:17
Deploy-PublicDNS.bicep
///Variables - Edit, these variables can be set in the script or implemented as part of Azure DevOps variables.
//Set the Domain Name Zone:
param PrimaryDNSZone string = ''
//Deploys to the location of your resource group, that is specified during the deployment.
var location = 'Global'
//Variable array for your A records. Add, remove and amend as needed, any new record needs to be included in {}.
var arecords = [
{
name: '@'
ipv4Address: '8.8.8.8'
@lukemurraynz
lukemurraynz / storageaccount.bicep
Last active December 27, 2021 08:26
storageaccount.bicep
param storageaccprefix string = ''
var location = resourceGroup().location
resource storageacc 'Microsoft.Storage/storageAccounts@2021-06-01' = {
name: '${storageaccprefix}${uniqueString(resourceGroup().id)}'
location: location
sku: {
name: 'Standard_ZRS'
}
kind: 'StorageV2'