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 / storageaccount.bicep
Created November 22, 2023 05:30
Azure Image Builder
// Define the location parameter for all resources
@description('Location for all resources.')
param location string = resourceGroup().location
// Define the parameter for the Storage account name
@description('The name of the Storage account.')
param stgaccountname string
// Define the parameter for the public access setting of the Storage account
@description('Sets the public access of the storage account.')
@lukemurraynz
lukemurraynz / azure-pipelines.yml
Created November 22, 2023 05:15
Azure Image Builder
# Define the pipeline name and trigger
name: Azure Image Builder - Build and Publish Image Template
trigger:
- main
# Define pipeline variables
variables:
serviceconnection: azserviceconnections
overwrite: false
@lukemurraynz
lukemurraynz / customizations.bicep
Created November 22, 2023 05:14
Azure Image Builder
// Define the parameter for the Storage account name
@description('The name of the Storage account.')
param stgaccountname string
// Get the environment-specific metadata
var environmentMetadata = environment()
// Define the customizations for the image
var customizations = [
// Create a apps directory on the OS drive
@lukemurraynz
lukemurraynz / main.bicep
Created November 22, 2023 05:13
Azure Image Builder
// Define parameters for the Bicep template
param location string = resourceGroup().location
param imagetemplatename string
param azComputeGalleryName string = 'myGallery'
@description('The name of the Storage account.')
param stgaccountname string
param azUserAssignedManagedIdentity string = 'useri'
// Define the details for the VM offer
var vmOfferDetails = {
#Hidden Tags demo
# Check with AzTags
Get-AzTag
# Add a tag to a resource demo
$replacedTags = @{"hidden-title" = "Web Server"; "hidden-ShutdownAutomation" = "Yes"}
$resouceGroup = 'hiddentags-demo'
@lukemurraynz
lukemurraynz / azure-pipelines.yml
Created September 13, 2023 01:58
Test connectivity Azure DevOps pipeline
trigger:
- main
pool:
name: containerapp-adoagent
jobs:
- job: Setup
displayName: Get Environment - Linux
@lukemurraynz
lukemurraynz / main.bicep
Last active September 13, 2023 03:02
Container Apps - ADO Agent
// Define parameters
// https://github.com/lukemurraynz/containerapps-selfhosted-agent
param location string = resourceGroup().location
@description('The location where the resources will be deployed. Based on the Resource Group location.')
param poolName string = 'containerapp-adoagent'
@description('The name of the Azure DevOps agent pool.')
@maxLength(50)
param containerregistryName string = 'adoregistry'
@description('The name of the Azure Container Registry.')
param adourl string = 'https://dev.azure.com/contoso'
@lukemurraynz
lukemurraynz / main.bicep
Last active August 28, 2023 01:34
VNET and NSG creation Azure Bicep
@description('Name of the virtual network.')
param vnetName string = 'myVnet'
@description('Name of the first subnet.')
param subnet1Name string = 'subnet1'
@description('Name of the second subnet.')
param subnet2Name string = 'subnet2'
@description('Name of the first network security group.')
@lukemurraynz
lukemurraynz / Initiate-DakaraSuperWeapon.ps1
Last active June 8, 2023 01:50
Deletes all resource groups under a management group except for the ones with a specific tag.
# This runbook deletes all resource groups under a management group except for the ones with a specific tag.
<#
.SYNOPSIS
Deletes all resource groups under a management group except for the ones with a specific tag.
.DESCRIPTION
This script deletes all resource groups under a specified management group except for the ones with a specific tag. It can also delete policy assignments and subscription role assignments if specified.
.PARAMETER ManagementGroupId
The ID of the management group to delete resource groups under. WARNING: This script will delete all resource groups under the specified management group except for the ones with the specified tag. Make sure you have specified the correct management group ID, or you may accidentally delete resources that you did not intend to delete.
@lukemurraynz
lukemurraynz / New-AzCountryIPGroup.p1
Created January 1, 2023 11:36
Creates an Azure IP group, with the IP address ranges for various countrues.
function New-AzCountryIPGroup {
<#
.SYNOPSIS
Creates an Azure IP group, with the IP address ranges for various countrues.
The code does the following:
1. It downloads the IP address ranges for the country specified.
2. It checks if the IP Group already exists, if it does, it adds the IP addresses to the existing IP Group.
3. If the total number of IP addresses is less than 5000, it will add the IP addresses to the existing IP Group.
4. If the total number of IP addresses is over 5000, it will create a new IP Group, with the same name as the existing IP Group, and it will add the IP addresses to the new IP Group.
5. If the new IP Group is over 5000, it will create a new IP Group, with the same name as the existing IP Group, and it will add the IP addresses to the new IP Group.