Skip to content

Instantly share code, notes, and snippets.

View bobalob's full-sized avatar

Dave Hall bobalob

View GitHub Profile
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"resourcesPrefix": {
"type": "string",
"metadata": {
"description": "The prefix for all resources in the template"
}
}
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"storageAccountName": {
"type": "string",
"metadata": {
"description": "The name for the Storage Account"
}
}
@bobalob
bobalob / DeployTemplate.PS1
Created January 17, 2017 19:19
Deploy a template to ARM
New-AzureRmResourceGroup -Name ExampleGroup -Location "North Europe"
New-AzureRmResourceGroupDeployment -Name ExampleGroupDeploy -ResourceGroupName ExampleGroup -TemplateFile BasicStorage.JSON
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {},
"variables": {},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"name": "randomstorage676",
"apiVersion": "2015-06-15",
Param(
$ServerName = "WIN-VCEI81MP4AD",
$UserAccountName="HypervUser",
$UserAccountPassword="P@ssw0rd1"
)
#The next line actually installs ALL hyper-v features including the hypervisor,
# I haven't had time to fix this yet so if this isn't acceptable you should
# remove the line and install the hyper-v client tools manually
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-Management-Clients -all -NoRestart
Param(
$UserAccountName="HypervUser",
$UserAccountPassword="P@ssw0rd1"
)
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All -NoRestart
Install-WindowsFeature RSAT-Hyper-V-Tools -IncludeAllSubFeature
NET USER $UserAccountName $UserAccountPassword /ADD
NET LOCALGROUP "Administrators" $UserAccountName /add
Enable-PSRemoting -Force
$RemoteHostName = $ENV:ComputerName
$ComputerName = $ENV:ComputerName
Write-Host "Setup WinRM for $RemoteHostName"
$Cert = New-SelfSignedCertificate -DnsName $RemoteHostName, $ComputerName `
-CertStoreLocation "cert:\LocalMachine\My"
$Cert | Out-String
@bobalob
bobalob / DSC-PartialsLCM-ConfigurationID-TestConfig.PS1
Last active December 13, 2016 20:19
Example configuration to store on the pullserver for the LCM configured with ConfigurationID
configuration ServerBuild
{
Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
Node $AllNodes.NodeName
{
File ServerBuild
{
DestinationPath = "C:\ServerBuild-1.txt"
Type = "File"
@bobalob
bobalob / DSC-PartialsLCM-ConfigurationID.PS1
Last active December 13, 2016 20:15
Example to configure the LCM for pulling partial configurations using the ConfigurationID method
[DSCLocalConfigurationManager()]
configuration PullClientConfigNames
{
Node $AllNodes.NodeName
{
Settings
{
RefreshMode = 'Pull'
RefreshFrequencyMins = 30
RebootNodeIfNeeded = $true
Configuration OdbcConfig
{
Param(
[Parameter(Mandatory=$true)][ValidateNotNullorEmpty()]$SQLServerName,
[Parameter(Mandatory=$true)][ValidateNotNullorEmpty()]$DatabaseName,
[Parameter(Mandatory=$true)][ValidateNotNullorEmpty()]$ODBCName,
[Parameter(Mandatory=$true)][ValidateNotNullorEmpty()]$ComputerName
)
Import-DscResource -ModuleName 'PSDesiredStateConfiguration'