Skip to content

Instantly share code, notes, and snippets.

View Ercenk's full-sized avatar

Ercenk Keresteci Ercenk

View GitHub Profile
@Ercenk
Ercenk / wormstorage.cs
Created March 25, 2022 20:18
Immutable storage example
using System.Text;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Storage;
using Azure.ResourceManager.Storage.Models;
using Azure.Storage.Blobs;
using Azure.Storage.Blobs.Models;
var resourceGroupName = "immutablestorage";
@Ercenk
Ercenk / getAzureAccount.cs
Last active March 23, 2022 18:56
Get an Azure management client in C# using az CLI app ID and interactive login
IAzure GetAzureClient()
{
// az CLI app Id - DO NOT CHANGE THIS
const string clientId = "04b07795-8ddb-461a-bbee-02f9e1bf7b46";
// Change those for your specific Azure subscription.
// TenantId is the directory id of the account you log in to for access your subscription
const string tenantId = "......";
const string subscriptionId = "....";
@Ercenk
Ercenk / Create a table.EXCEL.yaml
Created October 30, 2020 18:34
Creates a table.
name: Create a table
description: Creates a table.
host: EXCEL
api_set: {}
script:
content: |
$("#create-table").click(() => tryCatch(createTable));
async function createTable() {
await Excel.run(async (context) => {
Azure\Get-AzureStorageAccount
AzureResourceManager\Get-AzureStorageAccount
@Ercenk
Ercenk / gist:17d53cf9862a35cb15ab
Created May 28, 2015 23:27
Load both ASM and ARM
function Get-ScriptDirectory
{
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
Split-Path $Invocation.MyCommand.Path
}
# Trick to load in the Azure module
$preference = $ErrorActionPreference
$ErrorActionPreference = "SilentlyContinue"
Get-AzureAccount | Out-Null
@Ercenk
Ercenk / gist:d3ea0af360f0a7d7cd44
Created May 28, 2015 23:18
Switch Azure Mode
Switch-AzureMode AzureResourceManager
@Ercenk
Ercenk / Deploy template.ps1
Created May 7, 2015 23:30
Poor mans Azure IaaS templating-Deploy
# Read the contents
$pathToFile = "d:\somedir\somefile"
$vms = ConvertFrom-Json (Get-Content -Path $pathToFile | Out-String)
$vmsToBeCreated = @()
# Now loop over the objects and build the provisioning congs...
foreach ($vm in $vms)
{
@Ercenk
Ercenk / create template.ps1
Last active August 29, 2015 14:20
Poor mans Azure IaaS templating-Create
# Filter below can be quite complex, below is an example
$json = ConvertTo-Json (Get-AzureVM | Where-Object {$_.Name -like "pa*" -and $_.ServiceName -notlike "*dr"}) -Depth 10
$outputFile = "d:\somefolder\somefile"
Out-File -FilePath $outputFile -InputObject $json
@Ercenk
Ercenk / ARM Template outputs.json
Created May 6, 2015 18:14
ARM Template outputs
"outputs": {
"key1": {
"value": "value1",
"type" : "<type-of-value>"
}
}