Skip to content

Instantly share code, notes, and snippets.

View bobalob's full-sized avatar

Dave Hall bobalob

View GitHub Profile
Param(
[Parameter(Mandatory=$true)]$Domain,
[Parameter(Mandatory=$true)]$User,
[Parameter(Mandatory=$true)]$computerName
)
$WindowsAccount = Get-WmiObject -Class Win32_Account -Filter "Domain='$($domain)' and Name='$($user)'"
if ($WindowsAccount) {
#### Add user/group into the local group
ip_configuration {
name = "${var.vm_name_prefix}-${count.index}-ipConfig"
subnet_id = "${azurerm_subnet.subnet1.id}"
private_ip_address_allocation = "dynamic"
load_balancer_backend_address_pools_ids = ["${azurerm_lb_backend_address_pool.backend_pool.id}"]
load_balancer_inbound_nat_rules_ids = ["${element(azurerm_lb_nat_rule.winrm_nat.*.id, count.index)}"]
}
resource "azurerm_lb_nat_rule" "winrm_nat" {
location = "${var.azure_region_fullname}"
resource_group_name = "${azurerm_resource_group.resource_group.name}"
loadbalancer_id = "${azurerm_lb.load_balancer.id}"
name = "WinRM-HTTPS-vm-${count.index}"
protocol = "Tcp"
frontend_port = "${count.index + 10000}"
backend_port = "${var.vm_winrm_port}"
frontend_ip_configuration_name = "${var.vm_name_prefix}-ipconfig"
count = "${var.vm_count}"
# VIP address
resource "azurerm_public_ip" "load_balancer_public_ip" {
name = "${var.vm_name_prefix}-ip"
location = "${var.azure_region_fullname}"
resource_group_name = "${azurerm_resource_group.resource_group.name}"
public_ip_address_allocation = "dynamic"
domain_name_label = "${azurerm_resource_group.resource_group.name}"
}
# Front End Load Balancer
Start-Transcript -Path C:\Deploy.Log
Write-Host "Setup WinRM for $RemoteHostName"
$Cert = New-SelfSignedCertificate -DnsName $RemoteHostName, $ComputerName `
-CertStoreLocation "cert:\LocalMachine\My" `
-FriendlyName "Test WinRM Cert"
#This will not create the storage account for use with packer, just the auth
Param (
$ApplicationName="Packer",
$AppURL="http://packer.io",
[Parameter(Mandatory=$true)]$AppPassword,
$AppRoleAssigned="Owner"
)
$Account = Login-AzureRmAccount
$Subs = Get-AzureRmSubscription
{
"variables": {
"azure_client_id": "{{env `PACKER_ARM_CLIENT_ID`}}",
"azure_client_secret": "{{env `PACKER_ARM_CLIENT_SECRET`}}",
"azure_subscription_id": "{{env `PACKER_ARM_SUBSCRIPTION_ID`}}",
"azure_object_id": "{{env `PACKER_ARM_OBJECT_ID`}}"
},
"builders": [{
sudo apt-get update
sudo apt-get install -y jq nodejs npm
sudo npm install -g azure-cli
sudo ln -s /usr/bin/nodejs /usr/bin/node
@bobalob
bobalob / Network.tf
Last active November 3, 2016 20:33
Example Terraform files for Azure Resource Manager
# Create a virtual network in the web_servers resource group
resource "azurerm_virtual_network" "pipelineNetwork" {
name = "pipelineNetwork"
address_space = ["10.0.0.0/16"]
location = "North Europe"
resource_group_name = "${azurerm_resource_group.pipelineResources.name}"
}
resource "azurerm_subnet" "pipelineSubnet1" {
name = "pipelineSubnet1"
@bobalob
bobalob / Get-PoolDetails-Function.PS1
Created November 2, 2016 20:33
Simple Wrapper for EMC VNX Pool Details
Function Get-PoolDetails {
Param(
[Parameter(Mandatory=$true)]$StorageProc
)
$PoolInfo = naviseccli -h $StorageProc storagepool -list
$poolLine1TAG = "Pool Name"
$poolLine2TAG = "Pool ID"
$poolLine3TAG = "LUNs"
$poolLine4TAG = "User Capacity \(GBs\)"
$poolLine5TAG = "Available Capacity \(GBs\)"