Skip to content

Instantly share code, notes, and snippets.

View ljtill's full-sized avatar
🔨

Lyon Till ljtill

🔨
View GitHub Profile
@ljtill
ljtill / ApiVersions.ps1
Last active August 4, 2022 19:05
Provides the ability to lookup Resource API Versions
param(
[Parameter()]
[string]$Resource
)
process {
$providerNamespace = $resource.Split("/")[0]
$resourceType = $resource.Split("/")[1]
$resourceTypes = (Get-AzResourceProvider -ProviderNamespace $providerNamespace).ResourceTypes
@ljtill
ljtill / repos.sh
Created November 3, 2020 17:41
Provides the ability to clone all repositories
#!/bin/bash
for i in $(gh api -X GET /user/repos --field affiliation=owner --paginate | jq -r '.[].full_name'); do
gh repo clone $i
done
@ljtill
ljtill / Report.ps1
Last active August 1, 2022 13:20
Provides the ability to report on virtual machine information
function Get-AzVMInfo {
[CmdletBinding()]
param()
begin {
$filePath = (Get-Location).Path + "\Azure_Virtual_Machine_Details_" + (Get-Date -UFormat "%m-%d-%Y") + ".csv"
if (Test-Path -Path $filePath) { Remove-Item -Path $filePath -Force }
$subscriptions = Get-AzSubscription -TenantId $TenantId
}
@ljtill
ljtill / azuredeploy.json
Last active July 18, 2023 12:59
Provides the ability to deploy policy definition via arm template
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"input": {
"value": {
"Name": "Audit-Linux-SSH-Password",
"ResourceId": "/providers/Microsoft.Management/managementGroups/LT/providers/Microsoft.Authorization/policyDefinitions/Audit-Linux-SSH-Password",
"ResourceName": "Audit-Linux-SSH-Password",
"ResourceType": "Microsoft.Authorization/policyDefinitions",
@ljtill
ljtill / ManagementGroups.ps1
Last active August 8, 2022 08:00
Provides the ability to recursively remove Management Groups
param(
[Parameter()]
[string]$Id,
[Parameter()]
[string]$RootId
)
process {
$WarningPreferenceState = $WarningPreference
$WarningPreference = "SilentlyContinue"
@ljtill
ljtill / azuredeploy.json
Last active April 8, 2021 12:32
Provides the ability to deploy Management Groups with templates
{
"$schema": "https://schema.management.azure.com/schemas/2019-08-01/tenantDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"parentId": {
"type": "string",
"defaultValue": "[subscription().tenantId]"
}
},
"variables": {
@ljtill
ljtill / azuredeploy.json
Last active August 4, 2022 22:46
Provides the ability to deploy Policy Definitions with templates
{
"$schema": "https://schema.management.azure.com/schemas/2019-08-01/managementGroupDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"policyName": {
"type": "string",
"metadata": {
"description": "Provide name for the policyDefinition."
}
},
@ljtill
ljtill / azuredeploy.json
Last active August 2, 2020 16:06
Provides the ability to deploy Subscriptions with templates
{
"$schema": "https://schema.management.azure.com/schemas/2019-08-01/tenantDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"subGuid": {
"type": "string",
"defaultValue": "[guid(deployment().name)]"
},
"subDisplayName": {
"type": "string"
@ljtill
ljtill / Policy.ps1
Last active August 1, 2022 13:17
Provides the ability to thread the operations of retrieving Policy artefacts
Get-Job | Remove-Job
Import-Module -Name Az.Accounts
$profile = [Microsoft.Azure.Commands.Common.Authentication.Abstractions.AzureRmProfileProvider]::Instance.Profile
$client = New-Object Microsoft.Azure.Commands.ResourceManager.Common.RMProfileClient($profile)
$token = $client.AcquireAccessToken("")
$accessToken = $token.AccessToken
$params = @{
@ljtill
ljtill / azuredeploy.json
Last active October 19, 2020 09:50
Provides the ability to deploy Resource Groups with templates
{
"$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
},
"functions": [
],
"variables": {
},
"resources": [