Skip to content

Instantly share code, notes, and snippets.

View ljtill's full-sized avatar
🔨

Lyon Till ljtill

🔨
View GitHub Profile
@ljtill
ljtill / AzureRmAccessToken.cs
Last active October 4, 2018 21:58
Provides the ability to retrieve an Access Token via REST API
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using Newtonsoft.Json;
namespace Example
{
class Program
{
@ljtill
ljtill / AzureRmResourceGroups.ps1
Last active July 18, 2023 12:58
Provides the ability to retrieve Resource Groups via REST API
function Get-AzureRmResourceGroups {
<#
.SYNOPSIS
Get-AzureRmResourceGroups will retrieve all Resource Groups within a Subscription.
.DESCRIPTION
Provides the ability to retrieve all Resource Groups from a specific Subscription Id via REST API.
.EXAMPLE
Get-AzureRmResourceGroups -SubscriptionId $subscriptionId -AccessToken $accessToken.
.LINK
@ljtill
ljtill / AzureRmVirtualMachines.ps1
Last active October 4, 2018 21:55
Provides the ability to retrieve Virtual Machines via REST API
function Get-AzureRmVirtualMachines {
<#
.SYNOPSIS
Get-AzureRmVirtualMachines will retrieve all Virtual Machines within a Subscription.
.DESCRIPTION
Provides the ability to retrieve all Virtual Machines from a specific Subscription Id via REST API.
.EXAMPLE
Get-AzureRmVirtualMachines -SubscriptionId $subscriptionId -AccessToken $accessToken.
.LINK
@ljtill
ljtill / AzureRmApiVersions.ps1
Last active July 18, 2023 12:59
Provides the ability to retrieve API version of a Resource Provider
function Get-AzureRmApiVersion {
<#
.SYNOPSIS
Get-AzureRmApiVersion returns the api versions of Resource Providers.
.DESCRIPTION
Provides the ability to retrieve all api versions or the latest api version of a specific Resource Provider.
.EXAMPLE
Get-AzureRmApiVersion -SubscriptionId $subscriptionId -Namespace "" -ResourceType "" -AccessToken $accessToken
.LINK
@ljtill
ljtill / AzureRmVMRunCommands.ps1
Last active July 18, 2023 12:59
Provides the ability to execute scripts against Virtual Machines
function Invoke-AzureRmVMRunCommand {
<#
.SYNOPSIS
Invoke-AzureRmVMRunCommand will provide the ability to execute scripts against Virtual Machines.
.DESCRIPTION
Provides the ability to execute script files against Virtual Machines
.EXAMPLE
Invoke-AzureRmVMRunCommand -SubscriptionId $subscriptionId -ResourceGroupName $resourceGroupName -VirtualMachineName $virtualMachineName -ScriptPath $scriptPath -AccessToken $accessToken -Verbose
#>
@ljtill
ljtill / AzureRmResourceHealth.ps1
Last active July 18, 2023 12:58
Provides the ability to retrieve the Resource Health of all Resources
function Get-AzureRmResourceHealth {
<#
.SYNOPSIS
Get-AzureRmResourceHealth will retrieve the Resource Health of all Resources within a Subscription.
.DESCRIPTION
Provides the ability to retrieve the current status of all Resources within a specific Subscription Id.
.EXAMPLE
Get-AzureRmResourceHealth -SubscriptionId $subscriptionId -AccessToken $accessToken.
.LINK
@ljtill
ljtill / AzureRmResourceHealthHistory.ps1
Last active July 18, 2023 12:59
Provides the ability to retrieve all historical Resource Health
function Get-AzureRmResourceHealthHistory {
<#
.SYNOPSIS
Get-AzureRmResourceHealthHistory will retrieve the Resource Health History of a Resource.
.DESCRIPTION
Provides the ability to retrieve all historical Resource Health of a specific Resource Id.
.EXAMPLE
Get-AzureRmResourceHealthHistory -ResourceId $resourceId -AccessToken $accessToken.
.LINK
@ljtill
ljtill / Repositories.ps1
Last active December 6, 2019 16:36
Provides the ability to clone all GitHub repositories of an owner
function Invoke-GitHubRepositoriesClone {
[CmdletBinding()]
param (
[Parameter()]
[string]$PersonalAccessToken
)
begin {
$request = @{
@ljtill
ljtill / azure.py
Last active December 6, 2019 15:33
Provides the ability to retrieve Azure resources
import requests
import json
def tenants(token):
print('Tenants...')
url = 'https://management.azure.com/tenants?api-version=2018-02-01'
headers = {'Authorization': ('Bearer ' + token)}
try:
response = requests.get(url, headers=headers)
output = (json.loads(response.text))['value']
@ljtill
ljtill / repositories.py
Last active December 6, 2019 15:33
Provides the ability to clone all GitHub repositories
from subprocess import call
import requests
import json
class GitHub:
def repositories(self, token, path):
url = 'https://api.github.com/user/repos?affiliation=owner'
headers = {'Authorization': ('Bearer ' + token)}
try:
response = requests.get(url, headers=headers)