Skip to content

Instantly share code, notes, and snippets.

View CodeHeight's full-sized avatar
🏠
Into the void...

CodeHeight CodeHeight

🏠
Into the void...
View GitHub Profile
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "String"
},
"networkInterfaceName": {
"type": "String"
},
@CodeHeight
CodeHeight / 1.1_Introduction.ps1
Last active October 10, 2018 21:16
Powershell snapshots
Set-Location C:\
Clear-Host
$AzureRMModule = Find-Module AzureRM
$AllAzureRMModules = Find-Module AzureRM*
$AzureRMModule | Measure-Object
$AllAzureRMModules | Measure-Object
$AllAzureRMModules | Where-Object Name -like *Compute*
@CodeHeight
CodeHeight / GettingStarted.ps
Last active September 25, 2018 17:15
Getting started with PowerShell for Azure
Start-Transcript
Get-ExecutionPolicy
Set-ExecutionPolicy RemoteSigned
Install-Module azureRM -Force
Install-Module azure -AllowClobber
get-command -Module
(get-command -Module azurerm).count
@CodeHeight
CodeHeight / PatientUtil.vb
Created May 30, 2018 19:47
PL/SQL calculates current date with past date with decimal output.
Public Class PatientUtil
Public Shared Function FormatAge(ByVal date_age As String) As String
Dim date_age_year As String
Dim date_age_month As String
Dim date_age_delimiter As Char = "."c
Dim substrings() As String
'First, get it:
substrings = date_age.Split(date_age_delimiter)
'Second turn decimal (2.40) into readable string (2 years 4 months)
@CodeHeight
CodeHeight / Deploy-ContosoIaas.ps1
Created May 9, 2018 17:53
Build and Deploy Private Virtual Machine
### Define Deployment Variables
{
$location = 'southcentralus'
$resourceGroupName = 'rg874826'
$resourceDeploymentName = 'contoso-iaas-deployment'
$templatePath = $env:SystemDrive + '\Users\LabUser\Documents\HOL_Lab_Files\3_Deploying_Virtual_Machines'
$templateFile = 'contosoIaaS_3.json'
$template = $templatePath + '\' + $templateFile
$password = "C0nts0sP@55"
$securePassword = $password | ConvertTo-SecureString -AsPlainText -Force
@CodeHeight
CodeHeight / Deploy-SimpleIaaS.ps1
Created May 8, 2018 19:49
Deploy an IaaS Resource
### Define Deployment Variables
{
$resourceGroupName = 'rg553710'
$resourceProviderNamespace = 'Microsoft.Network'
$resourceTypeName = 'virtualNetworks'
$resourceGroupLocation = 'southcentralus'
$vNetName = 'vnet-contoso'
$vNetAddressPrefix = '172.16.0.0/16'
$vNetSubnet1Name = 'subnet-1'
@CodeHeight
CodeHeight / Deploy-SimplePaaS.ps1
Created May 8, 2018 19:43
Deploy a PaaS Resource
### Define Deployment Variables
{
$resourceGroupName = 'rg553710'
$resourceProviderNamespace = 'Microsoft.Web'
$resourceTypeName = 'sites'
$resourceGroupLocation = 'southcentralus'
$randomString = ([char[]]([char]'a'..[char]'z') + 0..9 | Sort-Object {Get-Random})[0..8] -join ''
$appNamePrefix = 'contoso'
@CodeHeight
CodeHeight / deployVM.ps
Last active May 8, 2018 17:46
Deploying Virtual Machines (PowerShell)
$stName = "storageVM"
$locName = "South Central US"
$rgName = "TestRG"
New-AzureRmResourceGroup -Name $rgName -Location $locName
$storageAcc = New-AzureRmStorageAccount -ResourceGroupName $rgName -Name $stName
-Type "Standard_GRS" -Location $locName
$singleSubnet = New-AzureRmVirtualNetworkSubnetConfig -Name singleSubnet
-AddressPrefix 10.0.0.0/24
$vnet = New-AzureRmVirtualNetwork -Name TestNet -ResourceGroupName $rgName -Location $locName - AddressPrefix 10.0.0.0/16 -Subnet $singleSubnet
$pip = New-AzureRmPublicIpAddress -Name TestPIP -ResourceGroupName $rgName -Location $locName - AllocationMethod Dynamic
@CodeHeight
CodeHeight / DeployWebServer.ps1
Created May 7, 2018 14:47
DSC and Custom Scripts (Manageing Virtual Machines > Configuration Management Tools)
get-windowsfeature web-server | install-windowsfeature
@CodeHeight
CodeHeight / Skeleton.vb
Created April 20, 2018 20:40
Multiple List objects in One object
Namespace Models
Public Class SkeletonOne
Public Property Id As String
Public Property Abbreviation As String
Public Property Date As String
End Class
Public Class SkeletonTwo
Public Property Id As String
Public Property Abbreviation As String