Skip to content

Instantly share code, notes, and snippets.

Avatar

Richard Kerslake kerslake

View GitHub Profile
View Get-BasicAuthHeader.ps1
$user = "your.email@domain.com"
$token = "abcdefg"
$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user,$token)))
$authHeader = "Basic {0}" -f $base64AuthInfo
View AzureMLDevForRunner.json.postman_collection
{
"id": "b2f6ffd1-e29f-6236-4182-1d5a4cffa9dc",
"name": "AzureMLDev for Runner",
"description": "",
"order": [
"4fdb61b3-c4ad-7cd6-9821-f3370bf84a16",
"63e9c211-961f-a8c5-88a7-7391b0ed9fd3"
],
"folders": [],
"timestamp": 1460473869463,
View AzureMLDev.json.postman_collection
{
"id": "6f127602-fd77-d0a4-f94c-74f23802bc38",
"name": "AzureMLDev",
"description": "",
"order": [
"6f090c73-b2ba-bb9c-414f-31aabf53ef38",
"5216df25-d102-0ef0-0cfe-d031872e4db7",
"1c067065-717f-3b88-34cc-30fbbad2ddc3",
"5c09d930-c2df-fbb5-e484-3d1f1f1dc262",
"2b06bcb3-247c-199b-ac2b-5669b3bbe91a"
View AzureMLDev.postman_environment
{
"id": "4d00bb5c-f606-8571-0c4c-9d1d2a405212",
"name": "AzureMLDev",
"values": [
{
"key": "workspace",
"value": "[YOUR VALUE HERE e.g. GUID]",
"type": "text",
"enabled": true
},
View FileResourceDscConfig.ps1
Configuration FileResourceDemo
{
Node "localhost"
{
File CreateFile {
DestinationPath = 'C:\Temp\Test.txt'
Ensure = "Present"
Contents = 'Hello World!'
}
View VmWithDscExtension.json
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"newStorageAccountName": {
"type": "string",
"metadata": {
"description": "Unique DNS Name for the Storage Account where the Virtual Machine's disks will be placed."
}
},
View Provision-VM.ps1
Configuration FileResourceDemo
{
Node "localhost"
{
File CreateFile {
DestinationPath = 'C:\Temp\Test.txt'
Ensure = "Present"
Contents = 'Hello World!'
}
View startup_config.ps1
[Reflection.Assembly]::LoadWithPartialName("Microsoft.WindowsAzure.ServiceRuntime")
$roleInstanceId = [Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment]::CurrentRoleInstance.Id
$appName = [Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment]::GetConfigurationSettingValue("NewRelic.AppName")
$filename = "${env:RoleRoot}\approot\WorkerRoleWithNewRelic.dll.config"
$xml = New-Object XML
if (Test-Path ($filename))
{
View startup_config.cmd
powershell.exe Set-ExecutionPolicy Unrestricted
powershell.exe .\startup_config.ps1 >> ..\startup-config-log.txt 2>>..\startup-config-error-log.txt
View ServiceDefinition.xml
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="AzureCloudServiceWithNewRelic" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2014-06.2.4">
<WorkerRole name="WorkerRoleWithNewRelic" vmsize="Small">
<Startup>
<Task commandLine="startup_config.cmd" executionContext="elevated" taskType="simple">
</Task>
</Startup>
</WorkerRole>
</ServiceDefinition>