Skip to content

Instantly share code, notes, and snippets.

@techbunny
techbunny / gist:4f9fa5258c807288f918
Last active August 29, 2015 14:25
AZCopy Lab Notes
SOURCE Storage Account
----------------------
Access Key -
URL -
DESTINATION Storage Account
----------------------------
Access Key -
URL -
@techbunny
techbunny / ImpLab_ManageTweaks
Created December 26, 2014 21:17
The Imperfect Lab: VM Manageablity Tweeks
# To add VMs to Availability Sets
Get-AzureVM -ServiceName "<cloudservicename>" -Name "<servername>"
| Set-AzureAvailabilitySet -AvailabilitySetName "<AVSetName>"
| Update-AzureVM
# To availability sets that exist in your subscription
(Get-AzureService).servicename
| foreach {Get-AzureVM -ServiceName $_ }
| select name,AvailabilitySetName
@techbunny
techbunny / ImpLab_EarlySnippets
Created December 23, 2014 23:15
The Imperfect Lab: Early Post Snippets
# Setting Keys for Azure VNET-to-VNET Connectivity
Set-AzureVNetGatewayKey -VNetName YourVNETName -LocalNetworkSiteName TheOppositeLocalNet -SharedKey abc123xyz
Set-AzureVNetGatewayKey -TheOtherVNetName YourVNETName -LocalNetworkSiteName TheOtherLocalNet -SharedKey abc123xyz
# Connect Remotely to VMs
$uri = Get-AzureWinRMUri -ServiceName $cloudServiceName -Name $Name
$cred = Get-Credential
Enter-PSSession -ConnectionUri $uri -Credential $cred
# Install Active Directory
@techbunny
techbunny / ImpLab_DeployVMs
Created December 23, 2014 23:21
The Imperfect Lab: Deploying VMs
# Set Your Subscription and Storage Account
Set-AzureSubscription -SubscriptionName "Visual Studio Ultimate with MSDN" -CurrentStorageAccount "imperfectstore"
# Set basic variables for your VM. In this case, this is the adminstrator name and password, as well as the name of the Windows Server 2012 R2 image available at the time of this exercise. You'll want to make sure to get the current name of whatever OS you want to install.
$un = "adminname"
$pwd = "secretpassword"
$image = "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201411.01-en.us-127GB.vhd"
# Pick up that VM image the full list with:
@techbunny
techbunny / ImpLab_AzureFiles
Last active August 29, 2015 14:12
The Imperfect Lab: Azure Files
# Created a new storage account:
New-AzureStorageAccount -StorageAccountName <storageaccountname> -Location ‘West US’
# Captured the Access Key as a variable:
$storageAccessKey = (Get-AzureStorageKey –StorageAccountName <storageaccountname>).Primary
# Created a security context with the access key:
$storageContext = New-AzureStorageContext <storageaccountname> $storageAccessKey
# Created a new share:
@techbunny
techbunny / ImpLab_StaticIPs
Created December 23, 2014 23:35
The Imperfect Lab: Static IPs
# You can double check that an address is free with:
Test-AzureStaticVNetIP –VNetName ImperfectNet –IPAddress 192.168.1.5
# To set the static address, I used:
Get-AzureVM -ServiceName ImperfectCore -Name DC-Cloud1 | Set-AzureStaticVNetIP -IPAddress "192.168.1.4" | Update-AzureVM
# Kick off the addition of my second domain controller in this domain, I used:
Install-ADDSDomainController -Credential (Get-Credential) -DatabasePath 'C:\Windows\NTDS' -DomainName 'imperfectlab.com'
-InstallDns:$true -LogPath 'C:\Windows\NTDS' -NoGlobalCatalog:$false -SiteName 'ImperfectNet' -SysvolPath 'C:\Windows\SYSVOL'
-NoRebootOnCompletion:$true -Force:$true -Verbose