Skip to content

Instantly share code, notes, and snippets.

View davoodharun's full-sized avatar
🎯
Focusing

Harun Davood davoodharun

🎯
Focusing
View GitHub Profile

Keybase proof

I hereby claim:

  • I am davoodharun on github.
  • I am davoodharun (https://keybase.io/davoodharun) on keybase.
  • I have a public key ASA_XIOJQ5wlaCxoLbtDNLnC6NxFC_xAZvMAVWfs3UwDtQo

To claim this, I am signing this object:

@davoodharun
davoodharun / 0_reuse_code.js
Created March 29, 2017 15:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@davoodharun
davoodharun / Execute-InitialSetup
Created February 15, 2017 15:14
Create storage account, automation account, key vault for automation with Octopus Deploy
#Script needs to be run with elevated priveleges, as it interacts with the local file system (for generation of a certificate)
#Executes the initial setup script, creating a dedicated resource group, storage account, and azure automation account.
#Optionally uploads arm templtes and pss runbooks to created storage account (if path specified)
#Optionally publishes all ps runbooks in specified directory to azure automation account created by the process.
& "$($PSScriptRoot)\Orchestration_InitialSetup.ps1" -subscriptionId "<Subscription ID>" `
-resourceGroupName "<Resource Group Name>" `
-StorageAccountNAme "<Storage Account Name (3-15 charaters all lowercase)>" `
-automationAccountName "<Automation Account Name>" `
-keyVaultName "<Key Vault Name>" `
@davoodharun
davoodharun / Execute-AzureDeploymentAutomationJob
Created February 15, 2017 15:09
Execute Azure Automation Job from Octopus Deploy
$clientId = $OctopusParameters['AzureGovernment.Account.ClientId']
$tenantId = $OctopusParameters['AzureGovernment.Account.TenantId']
$environmentName = $OctopusParameters['AzureGovernment.Account.EnvironmentName']
$key = $OctopusParameters['AzureGovernment.Account.KeyValue']
$subscriptionId = $OctopusParameters['AzureGovernment.SubscriptionId']
$automationAccountResourceGroupName = $OctopusParameters['AzureGovernment.Automation.AutomationAccountResourceGroupName']
$automationAccountName = $OctopusParameters['AzureGovernment.Automation.AutomationAccountName']
$runbookName = $OctopusParameters['AzureGovernment.AutomationRunbookName']
$targetResourceGroupName = $OctopusParameters['AzureGovernment.TargetResourceGroupName']
$templateResourceGroupName = $OctopusParameters['AzureGovernment.TemplateResourceGroupName']
@davoodharun
davoodharun / Create-AzureServicePrincipalForClient
Last active February 23, 2017 21:32
Create Azure Service Principal for starting and monitoring Azure Automation Job
Param (
[Parameter(Mandatory=$true)]
[String] $SubscriptionId,
[Parameter(Mandatory=$true)]
[String] $ApplicationDisplayName,
[string]$backupKeyVaultName
)
@davoodharun
davoodharun / Orchestration_InitialSetup.ps1
Last active July 29, 2018 10:17
Script to deploy Azure Automation Account, Storage Account, and Key Vault
#requires -RunAsAdministrator
#requires -Modules AzureRM
<#
.Description
Script needs to be run with elevated priveleges, as it interacts with the local file system (for generation of a certificate)
Executes the initial setup script, creating a dedicated resource group, storage account, and azure automation account.
Optionally uploads arm templtes and ps runbooks to created storage account (if path specified)
Optionally publishes all ps runbooks in specified directory to azure automation account created by the process.
@davoodharun
davoodharun / Create-AzureServicePrincipalForServerAutomation.ps1
Last active March 24, 2022 21:56
Create a service principal for Automation Account in Azure
#Requires -RunAsAdministrator
Param (
[Parameter(Mandatory=$true)]
[String] $SubscriptionId,
[Parameter(Mandatory=$true)]
[String] $ResourceGroup,
[Parameter(Mandatory=$true)]
@davoodharun
davoodharun / runbookAzureAutomation.ps1
Last active July 29, 2018 10:08
Sample PowerShell Runbook for Azure deployment
#The following is an Azure Automation PowerShell runbook.
#Uses a preconfigured AutomationConnection object (AzureRunAsConnection) for authentication
#This object must be in place in your tenant with the appropriate role(s), and added as a connection asset in the
#Azure Automation account being used.
Param(
[string]$environmentName = "AzureUSGovernment",
[Parameter(Mandatory=$true)]
[string]$subscriptionId,
[string]$location = "USGov Virginia",
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"addressPrefix": {
"value": "10.0.0.0/16"
},
"subnetPrefix": {
"value": "10.0.1.0/24"
},
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"addressPrefix": {
"type": "string",
"defaultValue": "10.0.0.0/16",
"metadata": {
"description": "Address prefix for the Virtual Network"
}