Skip to content

Instantly share code, notes, and snippets.

View PlagueHO's full-sized avatar
😼
Working on AI Foundry Solution Accelerator and AI Agent tools for TTRPGs

Daniel Scott-Raynsford PlagueHO

😼
Working on AI Foundry Solution Accelerator and AI Agent tools for TTRPGs
View GitHub Profile
@PlagueHO
PlagueHO / assign-reader-role-azure-machine-learning-enterprise-app.bicep
Created May 11, 2025 00:00
Bicep file that assigns the Azure Machine Learning service principal the Reader role on an existing Azure AI Search service using the Microsoft Graph Bicep extension.
// Use the Microsoft Graph Bicep extension to work with Entra ID resources
extension microsoftGraphV1
// The Service Principal of the Azure Machine Learning service.
resource azureMachineLearningServicePrincipal 'Microsoft.Graph/servicePrincipals@v1.0' = {
appId: '0736f41a-0425-4b46-bdb5-1563eff02385' // Azure Machine Learning service principal
}
// The existing Azure AI Search service (can be a new or existing resource).
resource azureAiSearch 'Microsoft.Search/searchServices@2025-02-01-preview' existing = {
@PlagueHO
PlagueHO / SSL.tests.ps1
Last active January 26, 2024 16:01
PowerShell Pester Tests for checking SSL endpoints
<#
.DESCRIPTION
Outputs the SSL protocols that the client is able to successfully use to connect to a server.
.PARAMETER ComputerName
The name of the remote computer to connect to.
.PARAMETER Port
The remote port to connect to. The default is 443.
@PlagueHO
PlagueHO / Create-Jenkins-Master-On-Windows-Server-Core.ps1
Last active January 11, 2024 15:44
Create a Jenkins Master on a Windows Server 2012 R2 Core install
# Configure the settings to use to setup this Jenkins Executor
$Port = 80
$IPAddress = '192.168.1.96'
$SubnetPrefixLength = 24
$DNSServers = @('192.168.1.1')
$DefaultGateway = '192.168.1.1'
# Install .NET Framework 3.5
Install-WindowsFeature -Name NET-Framework-Core
@PlagueHO
PlagueHO / split-multifunctionscriptintosinglefunctionfiles.ps1
Created November 2, 2018 07:46
Split a PowerShell Script containing multiple functions into a single function files
. .\utils.ps1
Get-Command *-CosmosDb* |
ForEach-Object {
$filename = Join-Path -Path (Get-Location) -ChildPath "$($_.name).ps1"
"function $($_.Name)`r`n{`r`n$($_.Definition)}" | Set-Content -Path $filename -Force
}
@PlagueHO
PlagueHO / Blog_ISCSIRemoveTargetPortalCorrect.ps1
Created December 26, 2015 22:23
Example: Correctly remove an iSCSI Target Portal
Remove-IscsiTargetPortal -TargetPortalAddress 192.168.129.24 -InitiatorPortalAddress 192.168.129.30
@PlagueHO
PlagueHO / Install-DockerOnWS2016ByDSC.ps1
Last active June 28, 2023 05:21
Install Docker on Windows Server 2016 RTM using DSC
Configuration ContainerHostDsc
{
# Set up general parameters used to determine paths where Docker will
# be installed to and downloaded from.
$ProgramFiles = $ENV:ProgramFiles
$DockerPath = Join-Path -Path $ProgramFiles -ChildPath 'Docker'
$DockerZipFileName = 'docker.zip'
$DockerZipPath = Join-Path -Path $ProgramFiles -ChildPath $DockerZipFilename
$DockerUri = 'https://download.docker.com/components/engine/windows-server/cs-1.12/docker.zip'
@PlagueHO
PlagueHO / NullCoalescingOperatorInPowerShell.ps1
Created August 18, 2019 08:36
Null Coalescing Operator In PowerShell
$notNull = ($x, $y, 1 -ne $null)[0] # Null Coalescing in PowerShell
@PlagueHO
PlagueHO / Export-Certificate.ps1
Created September 10, 2016 11:36
Export a Base-64 x.509 certificate on Windows 7
$certificate = Get-ChildItem -Path Get-ChildItem -path Cert:\CurrentUser\My\D675AE3AE9F7B56348C17EE527F261CFCEA0FD13
$base64certificate = @"
-----BEGIN CERTIFICATE-----
$([Convert]::ToBase64String($certificate.Export('Cert'), [System.Base64FormattingOptions]::InsertLineBreaks)))
-----END CERTIFICATE-----
"@
Set-Content -Path "$ENV:USERPROFILE\Documents\MyCert.cer" -Value $base64certificate
@PlagueHO
PlagueHO / azure-pipelines.yml
Created January 24, 2021 03:52
Example Azure DevOps Multi-Stage YAML Pipeline triggered off malicious branch
trigger:
branches:
include:
- 'main'
- 'malicious-change'
pr: none
stages:
- stage: Build
jobs:
@PlagueHO
PlagueHO / Invoke-AzContainerGroupCommand.ps1
Created October 26, 2020 02:57
Execute a command on an Azure Container Instance and return a terminal
$SubscriptionId = '<subscription id>'
$ResourceGroupName = 'my-container-rg'
$AciName = 'my-container-aci'
$resourceId = "/subscriptions/$($SubscriptionId)/resourceGroups/$($ResourceGroupName)/providers/Microsoft.ContainerInstance/containerGroups/$($AciName)/containers/$($AciName)"
$command = "/zap/zap-baseline.py -t 'https://myapplication.net' -x OWASP-ZAP-Report.xml"
Invoke-AzResourceAction `
-ResourceId $resourceId `
-Action 'exec' `
-ApiVersion '2019-12-01' `