Skip to content

Instantly share code, notes, and snippets.

View dazfuller's full-sized avatar
🤌
reality.foldLeft

Darren Fuller dazfuller

🤌
reality.foldLeft
View GitHub Profile
<#
.DESCRIPTION
Finds and removes VMs which have not been started within a defined period of time
.NOTES
AUTHOR: @dazfuller
LASTEDIT: Jan 26, 2017
#>
# Define the number of days after which a VM is considered dead
$NumberDays = 7
<#
.DESCRIPTION
Enables Transparent Data Encryption on all Azure SQL Databases within a subscription
.NOTES
AUTHOR: @dazfuller
LASTEDIT: Jan 12, 2017
#>
$connectionName = "AzureRunAsConnection"
<#
.DESCRIPTION
A runbook which finds storage accounts without encryption services enabled and
enables them
.NOTES
AUTHOR: @dazfuller
LASTEDIT: Jan 11, 2017
#>
workflow EnableStorageAccountEncryption
<#
.DESCRIPTION
A runbook which finds unrestricted inbound RDP rules on the standard RDP port and
changes their action to Deny
.NOTES
AUTHOR: @dazfuller
LASTEDIT: Jan 10, 2017
#>
workflow DisableRDPRules
workflow TestWorkflowRunbook
{
$connectionName = "AzureRunAsConnection"
try
{
$servicePrincipalConnection = Get-AutomationConnection -Name $connectionName
"Logging into Azure..."
Login-AzureRmAccount `
<#
.DESCRIPTION
A runbook which will scale down different types of resources for each resource group
.NOTES
AUTHOR: @dazfuller
LASTEDIT: Dec 20, 2016
#>
$connectionName = "AzureRunAsConnection"
@dazfuller
dazfuller / CheckAzureAppServices.ps1
Created December 19, 2016 08:49
Retrieves and outputs the details of the Azure Application Service plans under the current subscription
$AppServicePlans = Get-AzureRmAppServicePlan
$AppServicePlans | Sort-Object ResourceGroup, Name | Select-Object -Property `
ResourceGroup,
Name,
Location,
@{ name = "SkuName"; expression = { $_.Sku.Name } },
@{ name = "SkuSize"; expression = { $_.Sku.Size } },
@{ name = "SkuTier"; expression = { $_.Sku.Tier } },
NumberOfSites,
@dazfuller
dazfuller / AzureBlobDownload.cs
Last active March 30, 2021 16:22
Download files from Azure Blob Storage using a SAS token
using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Auth;
using Microsoft.WindowsAzure.Storage.Blob;
namespace AzureBlobStorage
function Get-Password {
Param (
[ValidateRange(8, 20)]
[int] $PasswordLength = 14,
[ValidateRange(1, 4)]
[int] $MinimumSpecialCharacters = 3
)
# Specify the range of ASCII characters to use, avoiding ambiguous characters such as 0, O, o
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Error "Need to run as an administrator"
return -1
}
$source = "https://letsencrypt.org/certs/lets-encrypt-x3-cross-signed.pem"
$file = $source.Split("/")[-1]
$out = Join-Path "$($env:USERPROFILE)\Downloads" -ChildPath $file
Invoke-WebRequest -Uri $source -OutFile $out