Skip to content

Instantly share code, notes, and snippets.

View Ercenk's full-sized avatar

Ercenk Keresteci Ercenk

View GitHub Profile
@Ercenk
Ercenk / Complex JavaScript objects.js
Last active August 29, 2015 14:20
Full Scale 180 blog post on Azure ARM templates at blog.fullscale180.com
var myObject = {
propertyOne: 1,
propertyTwo: 2
};
// And access propertyOne with the either with
myObject.propertyOne;
// or
myObject['propertyOne'];
@Ercenk
Ercenk / Imitating conditional.js
Last active August 29, 2015 14:20
Imitating conditional imperative construct in Azure ARM template
"properties": {
"mode": "Incremental",
"templateLink": {
"uri": "[concat(variables('templateBaseUrl'), 'jumpbox-resources-', parameters('jumpbox'), '.json')]",
"contentVersion": "1.0.0.0"
}
@Ercenk
Ercenk / Complex JSON object in template.js
Last active August 29, 2015 14:20
Full Scale 180 blog post on Azure ARM templates using complex JSON objects in templates
"networkSettings": {
"virtualNetworkName": "[parameters('virtualNetworkName')]",
"addressPrefix": "10.0.0.0/16",
"subnet": {
"name": "couchSubnet",
"prefix": "10.0.0.0/24"
},
"nodesIpPrefix": "10.0.0.1"
}
@Ercenk
Ercenk / Using complex JSON objects.js
Last active August 29, 2015 14:20
Full Scale 180 blog for Azure ARM templates
"parameters": {
"commonSettings": {
"value": "[variables('commonSettings')]"
},
"networkSettings": {
"value": "[variables('networkSettings')]"
},
"storageAccountNamePrefix": {
"value": "[parameters('storageAccountNamePrefix')]"
}
@Ercenk
Ercenk / create authorization header.cs
Last active August 29, 2015 14:20
Getting a OAuth bearer token for Azure Management APIs
var tenantId = "<tenant>.onmicrosoft.com";
var clientId = "<clientId";
var context = new AuthenticationContext(string.Format("https://login.windows.net/{0}", tenantId));
string user = "<username>@<tenant>.onmicrosoft.com";
string password = Util.ReadLine("Enter password");
var result = context.AcquireTokenAsync("https://management.core.windows.net/", clientId, new UserCredential(user, password)).Result;
@Ercenk
Ercenk / ARM template comments.json
Created May 5, 2015 23:10
Azure ARM template commenting for Full Scale 180 blog
"tshirtSizeLarge": {
"storageAccountCount": 5,
"clusterSizeMinusOne": 4,
"lastNodeId": 4,
"clusterSize": 5,
"couchbaseRamQuota": 88000,
"vmSize": "Standard_D14",
"maxNumberOfDataDisksForVmSizeNotUsedButHereForReference": 32}
@Ercenk
Ercenk / clusterspec.json
Created May 5, 2015 23:35
Full Scale 180 ARM template blog clusterspec
"clusterSpec": "[variables(concat('tshirtSize', parameters('tshirtSize')))]"
@Ercenk
Ercenk / desired custom script extension use.json
Last active August 29, 2015 14:20
Desired Custom Script Extension Use
{
"name": "[concat('cluster-node', copyindex())]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"dependsOn": [
"storageAccountsLoop"
],
"copy": {
"name": "clusterNodesLoop",
"count": "[variables('clusterSpec').clusterSize]"
@Ercenk
Ercenk / Custom script extension with N-1 Nodes and the last node in the cluster.json
Created May 6, 2015 18:04
Custom script extension with N-1 nodes for the cluster
{
"name": "[concat('cluster-node', copyindex())]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2015-01-01",
"dependsOn": [
"storageAccountsLoop"
],
"copy": {
"name": "clusterNodesLoop",
"count": "[variables('clusterSpec').clusterSizeMinusOne]"
@Ercenk
Ercenk / ARM Template outputs.json
Created May 6, 2015 18:14
ARM Template outputs
"outputs": {
"key1": {
"value": "value1",
"type" : "<type-of-value>"
}
}