Skip to content

Instantly share code, notes, and snippets.

View nmackenzie's full-sized avatar

Neil Mackenzie nmackenzie

  • Microsoft
  • San Francisco, CA
View GitHub Profile
@nmackenzie
nmackenzie / LoadBalancedVM.ps1
Created October 25, 2015 19:23
Create a load-balanced pair of Azure VMs
$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 October 25, 2015 19:09
Create a single VM using Azure PowerShell v1
$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 01:48
Create an AAD service principal and configure it for AAD authentication for the Azure PowerShell cmdlets
#
# 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 September 25, 2015 14:55
Create a load-balanced pair of Azure VMs
$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 October 22, 2015 16:08
Create an Azure VM with a public instance-level IP address
$testName = "lower-case-unique-name"
$resourceGroupName = $testName
$location = "West US"
$publisher = "MicrosoftWindowsServer"
$offer = "WindowsServer"
$sku = "2012-R2-Datacenter"
$version = "latest"
<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=
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();
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;
};
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));
public delegate T EntityResolver<T>(string partitionKey, string rowKey,
DateTimeOffset timestamp,
IDictionary<string, EntityProperty> properties, string etag);