Skip to content

Instantly share code, notes, and snippets.

View joshjohanning's full-sized avatar
:octocat:

Josh Johanning joshjohanning

:octocat:
View GitHub Profile
@joshjohanning
joshjohanning / migrate-nuget-packages.sh
Last active January 26, 2021 18:14
Migrate NuGet Packages script
echo -n "NuGet feed name?"
read nugetfeed
echo -n "NuGet feed source?"
read nugetsource
echo -n "Enter PAT"
read pat
# adding to ~/.config/NuGet/NuGet.config
nuget sources add -Name $nugetfeed -Source $nugetsource -username "az" -password $pat
results=$(find . -name "*.nupkg")
resultsArray=($results)
@joshjohanning
joshjohanning / github-delete-branch-protection.ps1
Created January 27, 2021 12:08
Delete GitHub Branch Protection Rules based upon pattern
##############################################################
# Delete branch protection rules
##############################################################
[CmdletBinding()]
param (
[parameter (Mandatory = $true)][string]$PersonalAccessToken,
[parameter (Mandatory = $true)][string]$GitHubOrg,
[parameter (Mandatory = $true)][string]$GitHubRepo,
[parameter (Mandatory = $true)][string]$PatternToDelete # If you want to delete all branch protection rules that start with "test", pass in "test*"
@joshjohanning
joshjohanning / vsts-sync-migration-tools.md
Last active September 30, 2021 00:54
VSTS Sync Migration Tools

VSTS Sync Migration Tools - v7.5.x (circa 2019)

The VSTS Sync Migration tools allow you to bulk edit and migrate data between Team Projects on both Microsoft Team Foundation Server (TFS) and Visual Studio Team Services (VSTS). You can find out why this tooling exists and you can access the documentation to find out how. THis project is published as code on GitHub as well as a VSTS Sync Migration Tools on Chocolaty and VSTS Bulk Data Editor Engine on NuGet. This allows you to build your own tooling as well as just use it out of the box with a configuration file.

Quick Links from Original Author

@joshjohanning
joshjohanning / configuration.json
Created September 30, 2021 05:04
configuration.json for nkdAgility/azure-devops-migration-tools - v8.9.x
{
"Version": "8.9",
"TelemetryEnableTrace": false,
"workaroundForQuerySOAPBugEnabled": false,
"Source": {
"Collection": "https://dev.azure.com/org",
"Project": "project",
"ReflectedWorkItemIDFieldName": "Custom.ReflectedWorkItemId",
"AllowCrossProjectLinking": false,
"PersonalAccessToken": ""
@joshjohanning
joshjohanning / storage_account.tf
Created October 27, 2021 15:01
private / locked down storage account sample
# This template is used to deploy the storage account resources
resource "azurecaf_name" "storage_account" {
name = "msi"
resource_type = "azurerm_storage_account"
prefixes = local.regional_name_prefixes
suffixes = local.azurecaf_name_suffixes
clean_input = true
}
@joshjohanning
joshjohanning / azdo-run-pipeline.ps1
Last active November 16, 2021 22:08
Queue Azure DevOps Pipeline via API, passing in parameters and variables
<# Resources:
https://stackoverflow.com/questions/60852825/azure-devops-yaml-pipeline-parameters-not-working-from-rest-api-trigger
https://stackoverflow.com/questions/34343084/start-a-build-and-passing-variables-through-azure-devops-rest-api
https://stackoverflow.com/questions/63654387/azure-rest-api-for-running-builds-or-pipelines
#>
param(
[Parameter(Mandatory=$true)]$pat = "",
$url = "https://dev.azure.com/jjohanning0798/",
$pipelineId = "77"
@joshjohanning
joshjohanning / github-cleanup-notifications.ps1
Last active November 16, 2021 22:20
Delete notification subscriptions for a specific org
##############################################################
# Delete all notification subscriptions for a specific org
##############################################################
# Description: You may have to run this multiple times - but it's better than:
# a) unwatching all repos or
# b) clicking thru yourself to unwatch
#
# See watched repos here: https://github.com/watching
@joshjohanning
joshjohanning / github-ghas-compare.md
Last active December 3, 2021 23:18
GitHub Advanced Security Compare
@joshjohanning
joshjohanning / azdo-create-iterations.ps1
Created September 30, 2021 01:38
Azure DevOps - Create Iterations PowerShell Script
# The iteration CSV should look something like this (no header):
# 20.6\1\1
# 20.6\1\2
# 20.6\2\1
# 20.6\2\2
# 19.1
# 19.1\1
# 19.1\1\2
# 19.3
@joshjohanning
joshjohanning / github-get-package-version-download
Last active January 7, 2022 19:55
Get package version download url for a specific package and specific version
{
repository(owner: "joshjohanning", name: "Wolfringo-github-packages") {
packages(first: 10, packageType: NUGET, names: "Wolfringo.Commands") {
edges {
node {
id
name
packageType
version(version: "1.1.2") {
id