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
@dazfuller
dazfuller / Get-AzureRmVMPrivateIPAddresses.ps1
Created June 14, 2017 11:40
Find the primary private IP address of VMs in Azure
$VMs = Get-AzureRmVM
$Results = @()
ForEach ($VM in $VMs)
{
ForEach ($NicID in $VM.NetworkInterfaceIDs)
{
$Nic = Get-AzureRmResource -ResourceId $NicID | Get-AzureRmNetworkInterface
$Result = New-Object PSObject
$Result | Add-Member -MemberType NoteProperty -Name "ResourceGroupName" -Value $VM.ResourceGroupName
<#
.DESCRIPTION
A runbook which will enable security settings for all database servers and databases in a subscription
.NOTES
AUTHOR: @dazfuller
LASTEDIT: Jan 30, 2016
#>
$connectionName = "AzureRunAsConnection"
<#
.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