Skip to content

Instantly share code, notes, and snippets.

Neil Mackenzie nmackenzie

View GitHub Profile
@nmackenzie
nmackenzie / LoadBalancedVM.ps1
Created Oct 25, 2015
Create a load-balanced pair of Azure VMs
View LoadBalancedVM.ps1
$testName = "lower-case-unique-name"
$resourceGroupName = $testName
$location = "westus"
$domainName = $testName
$subnetName = "Subnet-1"
$publisher = "MicrosoftWindowsServer"
$offer = "WindowsServer"
$sku = "2012-R2-Datacenter"
@nmackenzie
nmackenzie / SingleVM.ps1
Created Oct 25, 2015
Create a single VM using Azure PowerShell v1
View SingleVM.ps1
$testName = "lower-case-unique-name"
$resourceGroupName = $testName
$location = "westus"
$publisher = "MicrosoftWindowsServer"
$offer = "WindowsServer"
$sku = "2012-R2-Datacenter"
$version = "latest"
@nmackenzie
nmackenzie / CreateServicePrincipal.ps1
Created May 31, 2015
Create an AAD service principal and configure it for AAD authentication for the Azure PowerShell cmdlets
View CreateServicePrincipal.ps1
#
# Sign-in as a user in the Owner role
#
Add-AzureAccount
#
# Sign-in to MSOL
#
Connect-MsolService
@nmackenzie
nmackenzie / load-balanced-VMs.ps1
Last active Sep 25, 2015
Create a load-balanced pair of Azure VMs
View load-balanced-VMs.ps1
$testName = "lower-case-unique-name"
$resourceGroupName = $testName
$location = "West US"
$domainName = $testName
$subnetName = "Subnet-1"
$publisher = "MicrosoftWindowsServer"
$offer = "WindowsServer"
@nmackenzie
nmackenzie / one-VM.ps1
Last active Oct 22, 2015
Create an Azure VM with a public instance-level IP address
View one-VM.ps1
$testName = "lower-case-unique-name"
$resourceGroupName = $testName
$location = "West US"
$publisher = "MicrosoftWindowsServer"
$offer = "WindowsServer"
$sku = "2012-R2-Datacenter"
$version = "latest"
View PerformanceCounters
<PerformanceCounters bufferQuotaInMB="512" scheduledTransferPeriod="PT2M">
<PerformanceCounterConfiguration counterSpecifier=
"\Processor(_Total)\% Processor Time" sampleRate="PT30S" />
<PerformanceCounterConfiguration counterSpecifier=
"\Memory\Available MBytes" sampleRate="PT30S" />
<PerformanceCounterConfiguration counterSpecifier=
"\Memory\Committed MBytes" sampleRate="PT30S" />
<PerformanceCounterConfiguration counterSpecifier=
"\Web Service(_Total)\ISAPI Extension Requests/sec" sampleRate="PT1M" />
<PerformanceCounterConfiguration counterSpecifier=
View DynamicTableEntity
var query = (
from entity in bookTable.CreateQuery<DynamicTableEntity>()
where entity.Properties["PartitionKey"].StringValue == "hardback"”" &&
entity.Properties["Year"].Int32Value == 1912
select entity);
List<DynamicTableEntity> books = query.ToList();
View EntityResolver<Writer>
EntityResolver<Writer> resolver = (pk, rk, ts, props, etag) =>
{
Writer writer = new Writer() {
Information = String.Format("{0} wrote {1} in {2}",
props["Author"].StringValue, props["Name"].StringValue,
props["Year"].Int32Value)
};
return writer;
};
View UseResolver
var query =
(from book in bookTable.CreateQuery<DynamicTableEntity>()
where book.PartitionKey == "hardback"
select book).Resolve( (pk,rk,ts,props,etag) =>
String.Format("{0} wrote {1} in {2}",
props["Author"].StringValue, props["Name"].StringValue, props["Year"].Int32Value));
View EntityResolver
public delegate T EntityResolver<T>(string partitionKey, string rowKey,
DateTimeOffset timestamp,
IDictionary<string, EntityProperty> properties, string etag);
You can’t perform that action at this time.