Skip to content

Instantly share code, notes, and snippets.

@techbunny
Last active June 18, 2017 21:05
Show Gist options
  • Select an option

  • Save techbunny/399d2d6e8c952efab90d to your computer and use it in GitHub Desktop.

Select an option

Save techbunny/399d2d6e8c952efab90d to your computer and use it in GitHub Desktop.

Revisions

  1. techbunny revised this gist May 1, 2015. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -152,8 +152,12 @@ Enter-PSSession -ConnectionUri $uri -Credential $cred

    # Add ADDS and promote to DC:
    Add-WindowsFeature -name ad-domain-services -IncludeManagementTools

    # Note: When prompted for credentials, make sure to include the domain name for the administrator.
    # Example: CONTOSOAZURE\SysAdmin or [email protected]
    Install-ADDSDomainController -Credential (Get-Credential) -DatabasePath 'C:\Windows\NTDS' -DomainName 'contosoazure.com' -InstallDns:$true -LogPath 'C:\Windows\NTDS' -NoGlobalCatalog:$false -SiteName 'Default-First-Site-Name' -SysvolPath 'C:\Windows\SYSVOL' -NoRebootOnCompletion:$true -Force:$true -Verbose


    # NOTE: The DC restarts after making it a domain controller, so you'll need to re-enter the PowerShell remote session
    # when it's back up and running
    Enter-PSSession -ConnectionUri $uri -Credential $cred
  2. techbunny revised this gist May 1, 2015. 1 changed file with 77 additions and 51 deletions.
    128 changes: 77 additions & 51 deletions ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -1,54 +1,66 @@
    #-----------------------------------------------
    #Lab 1: Building the Foundation
    #Section: Connect to Azure with Powershell
    # Lab 1: Building the Foundation
    # Section: Connect to Azure with Powershell
    #----------------------------------------------

    Add-AzureAccount
    Get-AzureSubscription
    Add-AzureAccount # This prompts you for your Azure Subscription Account Credentials, and logs you in.

    Get-AzureSubscription | FT SubscriptionName # Get the list of Subscriptions your has access to.

    Get-AzureLocation | FT DisplayName # Show the datacenter region location names. (You will use the one you chose for your network location.)

    #-------------------------------------------------
    #Set Your Variables for the Lab - Setting the Variables here will ensure the script will work for your environment. Replace "ABC" with your initials or something unique for your deployment.
    # Set Your Variables for the Lab - Setting the Variables here will ensure the script will work for your environment. Replace "ABC" with your initials or something unique for your deployment.
    #-------------------------------------------------

    $subscriptionName = "Free Trial" #Replace with the friendly name of your subscription, if not using the free trial
    $storageAccountName = "abcstore" #storage name must be all lowercase
    $locationName = "West US"
    $domainCloudService = "ABCdomainservice"
    $dcAvalSet = "ABC-DCSet"
    # These variables must be edited:

    $subscrName = "Free Trial" # Replace with the friendly name of your subscription, if not using the free trial
    $storageAccountName = "xxxstore" # Storage name must be all lowercase. Replace xxx with your initials or some unique ID
    $domainCloudService = "XXXdomainservice" # Must be globally unique (used in a URL). Replace XXX with your initials or some unique ID
    $dcAvalSet = "XXX-DCSet" # Replace XXX with your initials or some unique ID
    $firstDC = "XXX-DC01" # Replace XXX with your initials or some unique ID
    $secondDC = "XXX-DC02" # Replace XXX with your initials or some unique ID

    # These variables must match what you configured for your network in Lab #1

    $VnetName = "XXX-Vnet" # <-- Edit to match your virtual network name
    $locationName = "West US" # <-- Edit to match your network location choice
    $subnet = "Core-Subnet" # <-- Edit if your network configuration first subnet name is different than the lab manual suggested

    # These variables can be left as-is. If you edit them, be sure to make note of the values for later.

    $serverImages = Get-AzureVMImage | Where {$_.ImageFamily -eq "Windows Server 2012 R2 Datacenter" } | sort-object -descending -Property PublishedDate
    $image = $serverImages[0].ImageName

    $subnet = "Core-Subnet"
    $instancesize = "Small"
    $VnetName = "ABC-Vnet"
    $un = "sysadmin"
    $pwd = "Passw0rd!"
    $firstDC = "ABC-DC01"
    $secondDC = "ABC-DC02"

    #Select the subscription to use for the lab (important if you have more than one subscription in your account)
    Select-AzureSubscription -subscriptionName $subscriptionName
    $un = "SysAdmin" # Remember the Username and Password
    $pwd = "Passw0rd!" # You'll use these creditials to connect to and/or login to your Domain Controllers


    # Select the subscription to use for the lab (important if you have more than one subscription in your account)
    Select-AzureSubscription -subscriptionName $subscrName

    #-----------------------------------------------
    #Lab 1: Building the Foundation
    #Section: Create a new storage account using PowerShell
    # Lab 1: Building the Foundation
    # Section: Create a new storage account using PowerShell
    #----------------------------------------------

    New-AzureStorageAccount -StorageAccountName $storageAccountName -Location $locationName
    Set-AzureSubscription -subscriptionName $subscrName -CurrentStorageAccount $storageAccountName

    #-----------------------------------------------
    #Lab 1: Building the Foundation
    #Section: Create a new service with PowerShell
    # Lab 1: Building the Foundation
    # Section: Create a new service with PowerShell
    #----------------------------------------------

    Set-AzureSubscription -subscriptionName $subscriptionName -CurrentStorageAccount $storageAccountName
    New-AzureService -ServiceName $domainCloudService -Location $locationName

    #-----------------------------------------------
    #Lab 2: Building Workloads
    #Section: Deploy domain controllers in Microsoft Azure
    #Task: Create First VM/DC in the domain
    # Lab 2: Building Workloads
    # Section: Deploy domain controllers in Microsoft Azure
    # Task: Create First VM/DC in the domain
    #-------------------------------------------------

    $newVM = New-AzureVMConfig -Name $firstDC -InstanceSize $instancesize -Image $image `
    @@ -57,84 +69,98 @@ $newVM = New-AzureVMConfig -Name $firstDC -InstanceSize $instancesize -Image $im

    New-AzureVM -VMs $newVM -ServiceName $domainCloudService -VNetName $VnetName

    #Move to Avail set
    # Move to Availability set (Wait until your DC is "Running" and not still "Provisioning" before executing this command.
    Get-AzureVm -ServiceName $domainCloudService -Name $firstDC | Set-AzureAvailabilitySet -AvailabilitySetName $dcAvalSet | Update-AzureVM

    #-----------------------------------------------
    #Lab 2: Building Workloads
    #Section: Preparing to Remotely Connect to Azure Virtual Machines
    # Lab 2: Building Workloads
    # Section: Preparing to Remotely Connect to Azure Virtual Machines
    #-------------------------------------------------

    #Install Certificate for remote connection to first Domain Controller
    #Add these lines at line 70 within the InstallWinRMCertzureVM.ps1 that you downloaded.
    # Install Certificate for remote connection to first Domain Controller
    # Add these lines at line 70 within the InstallWinRMCertzureVM.ps1 that you downloaded from http://aka.ms/psremotingscript

    $subscriptionName = "Free Trial" #Replace with the friendly name of your subscription, if not using the free trial
    $subscriptionName = $subscrName
    $ServiceName = $domainCloudService
    $Name = $firstDC


    #-----------------------------------------------
    #Lab 2: Building Workloads
    #Section: Create users in your Active Directory
    # Lab 2: Building Workloads
    # Section: Create users in your Active Directory
    #-------------------------------------------------

    #Connect Remotely to first DC
    # Connect Remotely to first DC
    $uri = Get-AzureWinRMUri -ServiceName $domainCloudService -Name $firstDC
    $cred = Get-Credential
    Enter-PSSession -ConnectionUri $uri -Credential $cred

    #After remote connection to domain controller is made:
    # After remote connection to domain controller is made:
    Add-WindowsFeature -name ad-domain-services -IncludeManagementTools
    Install-ADDSForest -DomainName "contosoazure.com" -ForestMode 6 -DomainMode 6

    #After the domain is configured, create OUs and Users:
    # NOTE: The DC restarts after installing the Forest, so you'll need to re-enter the PowerShell remote session
    # when it's back up and running
    Enter-PSSession -ConnectionUri $uri -Credential $cred

    # Back into the remote PS session, now you can create OUs and Users:
    New-ADOrganizationalUnit -Name "FINANCE" -Path "DC=contosoazure, DC=Com"
    New-ADOrganizationalUnit -Name "IT" -Path "DC=contosoazure, DC=Com"
    New-ADOrganizationalUnit -Name "SALES" -Path "DC=contosoazure, DC=Com"
    $newPassword = (Read-Host -Prompt "Provide New Password" -AsSecureString)

    $newPassword = (Read-Host -Prompt "Provide New Password" -AsSecureString) # Password for the new users

    New-ADUser -Name "Matt Deen" -Path "OU=FINANCE,dc=contosoazure,dc=com" -AccountPassword $newPassword -Department "Finance" -SamAccountName "MattDeen" -Surname "Deen" -GivenName "Matt" -DisplayName "Matt Deen"
    New-ADUser -Name "Bob Smith" -Path "OU=SALES,dc=contosoazure,dc=com" -SamAccountName "BobSmith" -GivenName "Bob" -Surname "Smith" -DisplayName "Bob Smith" -Department "Sales" -AccountPassword $newPassword
    New-ADUser -Name "Pat Holden" -SamAccountName "Pat Holden" -GivenName "Pat" -Surname "Holden" -DisplayName "Pat Holden" -Department "Finance" -AccountPassword $newPassword
    New-ADUser -Name "Dan Chun" -SamAccountName "Dan Chun" -GivenName "Dan" -Surname "Chun" -DisplayName "Dan Chun" -Department "Finance" -AccountPassword $newPassword
    New-ADUser -Name "Karen Vogue" -Path "OU=sales,dc=contosoazure,dc=com" -SamAccountName "KarenVogue" -GivenName "Karen" -Surname "Vogue" -DisplayName "Karen Vogue" -Department "Sales" -AccountPassword $newPassword

    #This enables a user account. You can repeat this command to enable more uses if desired.
    # This enables a user account. You can repeat this command to enable more uses if desired.
    Enable-ADAccount -Identity KarenVogue

    #-----------------------------------------------
    #Lab 2: Building Workloads
    #Section: Deploy the 2nd Domain Controller for your Forest
    # Lab 2: Building Workloads
    # Section: Deploy the 2nd Domain Controller for your Forest
    #-------------------------------------------------
    #Make sure to exit from the remote session on DC01 and return to controlling Azure directly by typing:
    # Make sure to exit from the remote session on DC01 and return to controlling Azure directly by typing:

    exit

    #Then continue on to deploy the 2nd DC, this time you will automatically deploy the machine to the correct Availability Set
    # Then continue on to deploy the 2nd DC, this time you will automatically deploy the machine to the correct Availability Set

    $newVM = New-AzureVMConfig -Name $secondDC -InstanceSize $instancesize -Image $image -AvailabilitySetName $dcAvalSet `
    | Add-AzureProvisioningConfig -Windows -Password $pwd -AdminUsername $un `
    | Set-AzureSubnet -SubnetNames $subnet

    New-AzureVM -VMs $newVM -ServiceName $domainCloudService

    #Install Certificate for remote connection to second Domain Controller
    #Edit these lines at line 70 within the InstallWinRMCertzureVM.ps1 that you downloaded.
    # Move 2nd DC to Avail set
    # ...already done! (Note the -AvailabilitySetName parameter in the New-AzureVMConfig cmdlet.)

    # Install Certificate for remote connection to second Domain Controller
    # Add these lines at line 70 within the InstallWinRMCertzureVM.ps1 that you downloaded from http://aka.ms/psremotingscript

    $subscriptionName = "Free Trial" #Replace with the friendly name of your subscription, if not using the free trial
    $subscriptionName = $subscrName
    $ServiceName = $domainCloudService
    $Name = $secondDC

    #Connect Remotely to second DC
    # Connect Remotely to second DC
    $uri = Get-AzureWinRMUri -ServiceName $domainCloudService -Name $secondDC
    $cred = Get-Credential
    Enter-PSSession -ConnectionUri $uri -Credential $cred

    #Add ADDS and promote to DC:
    # Add ADDS and promote to DC:
    Add-WindowsFeature -name ad-domain-services -IncludeManagementTools

    #Reconnect via PowerShell Remoting before Promoting:
    Install-ADDSDomainController -Credential (Get-Credential) -DatabasePath 'C:\Windows\NTDS' -DomainName 'contosoazure.com' -InstallDns:$true -LogPath 'C:\Windows\NTDS' -NoGlobalCatalog:$false -SiteName 'Default-First-Site-Name' -SysvolPath 'C:\Windows\SYSVOL' -NoRebootOnCompletion:$true -Force:$true -Verbose

    #Optional: Switch the 2nd Domain Controller to Server Core
    # NOTE: The DC restarts after making it a domain controller, so you'll need to re-enter the PowerShell remote session
    # when it's back up and running
    Enter-PSSession -ConnectionUri $uri -Credential $cred

    # Optional: Switch the 2nd Domain Controller to Server Core by removing the User Interface.
    Remove-WindowsFeature -name User-Interfaces-Infra
    Restart-Computer

    # Be patient. It takes a while. Once the machine is back up and running, Connect to it (Remote Desktop) to verify that
    # it is just the core OS.
  3. techbunny revised this gist Apr 29, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -100,7 +100,7 @@ New-ADUser -Name "Dan Chun" -SamAccountName "Dan Chun" -GivenName "Dan" -Surname
    New-ADUser -Name "Karen Vogue" -Path "OU=sales,dc=contosoazure,dc=com" -SamAccountName "KarenVogue" -GivenName "Karen" -Surname "Vogue" -DisplayName "Karen Vogue" -Department "Sales" -AccountPassword $newPassword

    #This enables a user account. You can repeat this command to enable more uses if desired.
    Enable-ADAccount Identity KarenVogue
    Enable-ADAccount -Identity KarenVogue

    #-----------------------------------------------
    #Lab 2: Building Workloads
  4. techbunny revised this gist Apr 24, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -100,7 +100,7 @@ New-ADUser -Name "Dan Chun" -SamAccountName "Dan Chun" -GivenName "Dan" -Surname
    New-ADUser -Name "Karen Vogue" -Path "OU=sales,dc=contosoazure,dc=com" -SamAccountName "KarenVogue" -GivenName "Karen" -Surname "Vogue" -DisplayName "Karen Vogue" -Department "Sales" -AccountPassword $newPassword

    #This enables a user account. You can repeat this command to enable more uses if desired.
    Enable-ADAccount –Indentity KarenVogue
    Enable-ADAccount –Identity KarenVogue

    #-----------------------------------------------
    #Lab 2: Building Workloads
  5. techbunny revised this gist Apr 24, 2015. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -99,7 +99,8 @@ New-ADUser -Name "Pat Holden" -SamAccountName "Pat Holden" -GivenName "Pat" -Sur
    New-ADUser -Name "Dan Chun" -SamAccountName "Dan Chun" -GivenName "Dan" -Surname "Chun" -DisplayName "Dan Chun" -Department "Finance" -AccountPassword $newPassword
    New-ADUser -Name "Karen Vogue" -Path "OU=sales,dc=contosoazure,dc=com" -SamAccountName "KarenVogue" -GivenName "Karen" -Surname "Vogue" -DisplayName "Karen Vogue" -Department "Sales" -AccountPassword $newPassword

    Enable-ADuser -Identity KarenVogue
    #This enables a user account. You can repeat this command to enable more uses if desired.
    Enable-ADAccount –Indentity KarenVogue

    #-----------------------------------------------
    #Lab 2: Building Workloads
  6. techbunny revised this gist Apr 24, 2015. 1 changed file with 1 addition and 4 deletions.
    5 changes: 1 addition & 4 deletions ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -108,17 +108,14 @@ Enable-ADuser -Identity KarenVogue
    #Make sure to exit from the remote session on DC01 and return to controlling Azure directly by typing:
    exit

    #Then continue on to deploy the 2nd DC
    #Then continue on to deploy the 2nd DC, this time you will automatically deploy the machine to the correct Availability Set

    $newVM = New-AzureVMConfig -Name $secondDC -InstanceSize $instancesize -Image $image -AvailabilitySetName $dcAvalSet `
    | Add-AzureProvisioningConfig -Windows -Password $pwd -AdminUsername $un `
    | Set-AzureSubnet -SubnetNames $subnet

    New-AzureVM -VMs $newVM -ServiceName $domainCloudService

    #Move 2nd DC to Avail set
    Get-AzureVm -ServiceName $domainCloudService -Name $secondDC | Set-AzureAvailabilitySet -AvailabilitySetName $dcAvalSet | Update-AzureVM

    #Install Certificate for remote connection to second Domain Controller
    #Edit these lines at line 70 within the InstallWinRMCertzureVM.ps1 that you downloaded.

  7. techbunny revised this gist Apr 24, 2015. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -94,10 +94,10 @@ New-ADOrganizationalUnit -Name "SALES" -Path "DC=contosoazure, DC=Com"
    $newPassword = (Read-Host -Prompt "Provide New Password" -AsSecureString)

    New-ADUser -Name "Matt Deen" -Path "OU=FINANCE,dc=contosoazure,dc=com" -AccountPassword $newPassword -Department "Finance" -SamAccountName "MattDeen" -Surname "Deen" -GivenName "Matt" -DisplayName "Matt Deen"
    New-ADUser -Name "Bob Smith" -Path "OU=SALES,dc=contosoazure,dc=com" -SamAccountName "BobSmith" -GivenName "Bob" -Surname "Smith" -DisplayName "Bob Smith" Department "Sales" -AccountPassword $newPassword
    New-ADUser -Name "Pat Holden" -SamAccountName "Pat Holden" -GivenName "Pat" -Surname "Holden" -DisplayName "Pat Holden" Department "Finance" -AccountPassword $newPassword
    New-ADUser -Name "Dan Chun" -SamAccountName "Dan Chun" -GivenName "Dan" -Surname "Chun" -DisplayName "Dan Chun" Department "Finance" -AccountPassword $newPassword
    New-ADUser -Name "Karen Vogue" -Path "OU=sales,dc=contosoazure,dc=com" -SamAccountName "KarenVogue" -GivenName "Karen" -Surname "Vogue" -DisplayName "Karen Vogue" Department "Sales" -AccountPassword $newPassword
    New-ADUser -Name "Bob Smith" -Path "OU=SALES,dc=contosoazure,dc=com" -SamAccountName "BobSmith" -GivenName "Bob" -Surname "Smith" -DisplayName "Bob Smith" -Department "Sales" -AccountPassword $newPassword
    New-ADUser -Name "Pat Holden" -SamAccountName "Pat Holden" -GivenName "Pat" -Surname "Holden" -DisplayName "Pat Holden" -Department "Finance" -AccountPassword $newPassword
    New-ADUser -Name "Dan Chun" -SamAccountName "Dan Chun" -GivenName "Dan" -Surname "Chun" -DisplayName "Dan Chun" -Department "Finance" -AccountPassword $newPassword
    New-ADUser -Name "Karen Vogue" -Path "OU=sales,dc=contosoazure,dc=com" -SamAccountName "KarenVogue" -GivenName "Karen" -Surname "Vogue" -DisplayName "Karen Vogue" -Department "Sales" -AccountPassword $newPassword

    Enable-ADuser -Identity KarenVogue

  8. techbunny revised this gist Apr 24, 2015. 1 changed file with 8 additions and 7 deletions.
    15 changes: 8 additions & 7 deletions ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -88,17 +88,18 @@ Add-WindowsFeature -name ad-domain-services -IncludeManagementTools
    Install-ADDSForest -DomainName "contosoazure.com" -ForestMode 6 -DomainMode 6

    #After the domain is configured, create OUs and Users:
    New-ADOrganizationalUnit Name "FINANCE" Path "DC=contosoazure, DC=Com"
    New-ADOrganizationalUnit Name "IT" Path "DC=contosoazure, DC=Com"
    New-ADOrganizationalUnit Name "SALES" Path "DC=contosoazure, DC=Com"
    New-ADOrganizationalUnit -Name "FINANCE" -Path "DC=contosoazure, DC=Com"
    New-ADOrganizationalUnit -Name "IT" -Path "DC=contosoazure, DC=Com"
    New-ADOrganizationalUnit -Name "SALES" -Path "DC=contosoazure, DC=Com"
    $newPassword = (Read-Host -Prompt "Provide New Password" -AsSecureString)

    New-ADUser -Name "Matt Deen" -Path "OU=FINANCE,dc=contosoazure,dc=com" -AccountPassword $newPassword -Department "Finance" -SamAccountName "MattDeen" -Surname "Deen" -GivenName "Matt" -DisplayName "Matt Deen"
    New-ADUser Name "Bob Smith" -Path "OU=SALES,dc=contosoazure,dc=com" -SamAccountName "BobSmith" -GivenName "Bob" -Surname "Smith" -DisplayName "Bob Smith" –Department "Sales" -AccountPassword $newPassword
    New-ADUser Name "Pat Holden" -SamAccountName "Pat Holden" -GivenName "Pat" -Surname "Holden" -DisplayName "Pat Holden" –Department "Finance" -AccountPassword $newPassword
    New-ADUser Name "Dan Chun" -SamAccountName "Dan Chun" -GivenName "Dan" -Surname "Chun" -DisplayName "Dan Chun" –Department "Finance" -AccountPassword $newPassword
    New-ADUser Name "Karen Vogue" -Path "OU=sales,dc=contosoazure,dc=com" -SamAccountName "KarenVogue" -GivenName "Karen" -Surname "Vogue" -DisplayName "Karen Vogue" –Department "Sales" -AccountPassword $newPassword
    New-ADUser -Name "Bob Smith" -Path "OU=SALES,dc=contosoazure,dc=com" -SamAccountName "BobSmith" -GivenName "Bob" -Surname "Smith" -DisplayName "Bob Smith" –Department "Sales" -AccountPassword $newPassword
    New-ADUser -Name "Pat Holden" -SamAccountName "Pat Holden" -GivenName "Pat" -Surname "Holden" -DisplayName "Pat Holden" –Department "Finance" -AccountPassword $newPassword
    New-ADUser -Name "Dan Chun" -SamAccountName "Dan Chun" -GivenName "Dan" -Surname "Chun" -DisplayName "Dan Chun" –Department "Finance" -AccountPassword $newPassword
    New-ADUser -Name "Karen Vogue" -Path "OU=sales,dc=contosoazure,dc=com" -SamAccountName "KarenVogue" -GivenName "Karen" -Surname "Vogue" -DisplayName "Karen Vogue" –Department "Sales" -AccountPassword $newPassword

    Enable-ADuser -Identity KarenVogue

    #-----------------------------------------------
    #Lab 2: Building Workloads
  9. techbunny revised this gist Apr 24, 2015. No changes.
  10. techbunny revised this gist Apr 24, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -109,7 +109,7 @@ exit

    #Then continue on to deploy the 2nd DC

    $newVM = New-AzureVMConfig -Name $secondDC -InstanceSize $instancesize -Image $image `
    $newVM = New-AzureVMConfig -Name $secondDC -InstanceSize $instancesize -Image $image -AvailabilitySetName $dcAvalSet `
    | Add-AzureProvisioningConfig -Windows -Password $pwd -AdminUsername $un `
    | Set-AzureSubnet -SubnetNames $subnet

  11. techbunny revised this gist Apr 24, 2015. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -104,6 +104,10 @@ New-ADUser –Name "Karen Vogue" -Path "OU=sales,dc=contosoazure,dc=com" -SamAcc
    #Lab 2: Building Workloads
    #Section: Deploy the 2nd Domain Controller for your Forest
    #-------------------------------------------------
    #Make sure to exit from the remote session on DC01 and return to controlling Azure directly by typing:
    exit

    #Then continue on to deploy the 2nd DC

    $newVM = New-AzureVMConfig -Name $secondDC -InstanceSize $instancesize -Image $image `
    | Add-AzureProvisioningConfig -Windows -Password $pwd -AdminUsername $un `
  12. techbunny revised this gist Apr 24, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -28,7 +28,7 @@ $firstDC = "ABC-DC01"
    $secondDC = "ABC-DC02"

    #Select the subscription to use for the lab (important if you have more than one subscription in your account)
    Select-AzureSubscription -default -subscriptionName $subscriptionName
    Select-AzureSubscription -subscriptionName $subscriptionName

    #-----------------------------------------------
    #Lab 1: Building the Foundation
  13. techbunny revised this gist Apr 24, 2015. 1 changed file with 3 additions and 6 deletions.
    9 changes: 3 additions & 6 deletions ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -126,15 +126,12 @@ $uri = Get-AzureWinRMUri -ServiceName $domainCloudService -Name $secondDC
    $cred = Get-Credential
    Enter-PSSession -ConnectionUri $uri -Credential $cred

    #Optional: Switch the 2nd Domain Controller to Server Core
    Remove-WindowsFeature -name User-Interfaces-Infra

    #Add ADDS and promote to DC:
    Add-WindowsFeature -name ad-domain-services -IncludeManagementTools

    Restart-Computer

    #Reconnect via PowerShell Remoting before Promoting:
    Install-ADDSDomainController -Credential (Get-Credential) -DatabasePath 'C:\Windows\NTDS' -DomainName 'contosoazure.com' -InstallDns:$true -LogPath 'C:\Windows\NTDS' -NoGlobalCatalog:$false -SiteName 'Default-First-Site-Name' -SysvolPath 'C:\Windows\SYSVOL' -NoRebootOnCompletion:$true -Force:$true -Verbose


    #Optional: Switch the 2nd Domain Controller to Server Core
    Remove-WindowsFeature -name User-Interfaces-Infra
    Restart-Computer
  14. techbunny revised this gist Apr 23, 2015. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -132,6 +132,9 @@ Remove-WindowsFeature -name User-Interfaces-Infra
    #Add ADDS and promote to DC:
    Add-WindowsFeature -name ad-domain-services -IncludeManagementTools

    Restart-Computer

    #Reconnect via PowerShell Remoting before Promoting:
    Install-ADDSDomainController -Credential (Get-Credential) -DatabasePath 'C:\Windows\NTDS' -DomainName 'contosoazure.com' -InstallDns:$true -LogPath 'C:\Windows\NTDS' -NoGlobalCatalog:$false -SiteName 'Default-First-Site-Name' -SysvolPath 'C:\Windows\SYSVOL' -NoRebootOnCompletion:$true -Force:$true -Verbose


  15. techbunny revised this gist Apr 23, 2015. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -126,9 +126,12 @@ $uri = Get-AzureWinRMUri -ServiceName $domainCloudService -Name $secondDC
    $cred = Get-Credential
    Enter-PSSession -ConnectionUri $uri -Credential $cred

    #Optional: Switch the 2nd Domain Controller to Server Core
    Remove-WindowsFeature -name User-Interfaces-Infra

    #Add ADDS and promote to DC:
    Add-WindowsFeature -name ad-domain-services -IncludeManagementTools

    Install-ADDSDomainController -Credential (Get-Credential) -DatabasePath 'C:\Windows\NTDS' -DomainName 'contosoazure.com' -InstallDns:$true -LogPath 'C:\Windows\NTDS' -NoGlobalCatalog:$false -SiteName 'Default-First-Site-Name' -SysvolPath 'C:\Windows\SYSVOL' -NoRebootOnCompletion:$true -Force:$true -Verbose

    #Switch the 2nd Domain Controller to Server Core
    Remove-WindowsFeature -name User-Interfaces-Infra

  16. techbunny revised this gist Apr 23, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -97,7 +97,7 @@ New-ADUser -Name "Matt Deen" -Path "OU=FINANCE,dc=contosoazure,dc=com" -AccountP
    New-ADUser –Name "Bob Smith" -Path "OU=SALES,dc=contosoazure,dc=com" -SamAccountName "BobSmith" -GivenName "Bob" -Surname "Smith" -DisplayName "Bob Smith" –Department "Sales" -AccountPassword $newPassword
    New-ADUser –Name "Pat Holden" -SamAccountName "Pat Holden" -GivenName "Pat" -Surname "Holden" -DisplayName "Pat Holden" –Department "Finance" -AccountPassword $newPassword
    New-ADUser –Name "Dan Chun" -SamAccountName "Dan Chun" -GivenName "Dan" -Surname "Chun" -DisplayName "Dan Chun" –Department "Finance" -AccountPassword $newPassword
    New-ADUser –Name "Karen Vogue" -Path "OU=sales,dc=contosozaure,dc=com" -SamAccountName "KarenVogue" -GivenName "Karen" -Surname "Vogue" -DisplayName "Karen Vogue" –Department "Sales" -AccountPassword $newPassword
    New-ADUser –Name "Karen Vogue" -Path "OU=sales,dc=contosoazure,dc=com" -SamAccountName "KarenVogue" -GivenName "Karen" -Surname "Vogue" -DisplayName "Karen Vogue" –Department "Sales" -AccountPassword $newPassword


    #-----------------------------------------------
  17. techbunny revised this gist Apr 23, 2015. 1 changed file with 8 additions and 7 deletions.
    15 changes: 8 additions & 7 deletions ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -87,16 +87,17 @@ Enter-PSSession -ConnectionUri $uri -Credential $cred
    Add-WindowsFeature -name ad-domain-services -IncludeManagementTools
    Install-ADDSForest -DomainName "contosoazure.com" -ForestMode 6 -DomainMode 6

    New-ADOrganizationalUnit –Name “FINANCE” –Path “DC=contosoazure, DC=Com”
    New-ADOrganizationalUnit –Name “IT” –Path “DC=contosoazure, DC=Com”
    New-ADOrganizationalUnit –Name “SALES” –Path “DC=contosoazure, DC=Com”
    #After the domain is configured, create OUs and Users:
    New-ADOrganizationalUnit –Name "FINANCE" –Path "DC=contosoazure, DC=Com"
    New-ADOrganizationalUnit –Name "IT" –Path "DC=contosoazure, DC=Com"
    New-ADOrganizationalUnit –Name "SALES" –Path "DC=contosoazure, DC=Com"
    $newPassword = (Read-Host -Prompt "Provide New Password" -AsSecureString)

    New-ADUser -Name "Matt Deen" -Path "OU=FINANCE,dc=contosoazure,dc=com" -AccountPassword $newPassword -Department "Finance" -SamAccountName "MattDeen" -Surname "Deen" -GivenName "Matt" -DisplayName "Matt Deen"
    New-ADUser –Name Bob Smith -Path "OU=SALES,dc=contosoazure,dc=com" -SamAccountName "BobSmith" -GivenName "Bob" -Surname "Smith" -DisplayName "Bob Smith" –Department Sales" -AccountPassword $newPassword
    New-ADUser –Name Pat Holden -SamAccountName "Pat Holden" -GivenName "Pat" -Surname "Holden" -DisplayName "Pat Holden" –Department Finance" -AccountPassword $newPassword
    New-ADUser –Name Dan Chun -SamAccountName "Dan Chun" -GivenName "Dan" -Surname "Chun" -DisplayName "Dan Chun" –Department Finance" -AccountPassword $newPassword
    New-ADUser –Name Karen Vogue -Path "OU=sales,dc=contosozaure,dc=com" -SamAccountName "KarenVogue" -GivenName "Karen" -Surname "Vogue" -DisplayName "Karen Vogue" –Department Sales" -AccountPassword $newPassword
    New-ADUser –Name "Bob Smith" -Path "OU=SALES,dc=contosoazure,dc=com" -SamAccountName "BobSmith" -GivenName "Bob" -Surname "Smith" -DisplayName "Bob Smith" –Department "Sales" -AccountPassword $newPassword
    New-ADUser –Name "Pat Holden" -SamAccountName "Pat Holden" -GivenName "Pat" -Surname "Holden" -DisplayName "Pat Holden" –Department "Finance" -AccountPassword $newPassword
    New-ADUser –Name "Dan Chun" -SamAccountName "Dan Chun" -GivenName "Dan" -Surname "Chun" -DisplayName "Dan Chun" –Department "Finance" -AccountPassword $newPassword
    New-ADUser –Name "Karen Vogue" -Path "OU=sales,dc=contosozaure,dc=com" -SamAccountName "KarenVogue" -GivenName "Karen" -Surname "Vogue" -DisplayName "Karen Vogue" –Department "Sales" -AccountPassword $newPassword


    #-----------------------------------------------
  18. techbunny revised this gist Apr 23, 2015. 1 changed file with 7 additions and 5 deletions.
    12 changes: 7 additions & 5 deletions ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,9 @@ $locationName = "West US"
    $domainCloudService = "ABCdomainservice"
    $dcAvalSet = "ABC-DCSet"

    $image = "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201502.01-en.us-127GB.vhd"
    $serverImages = Get-AzureVMImage | Where {$_.ImageFamily -eq "Windows Server 2012 R2 Datacenter" } | sort-object -descending -Property PublishedDate
    $image = $serverImages[0].ImageName

    $subnet = "Core-Subnet"
    $instancesize = "Small"
    $VnetName = "ABC-Vnet"
    @@ -67,7 +69,7 @@ Get-AzureVm -ServiceName $domainCloudService -Name $firstDC | Set-AzureAvailabil
    #Add these lines at line 70 within the InstallWinRMCertzureVM.ps1 that you downloaded.

    $subscriptionName = "Free Trial" #Replace with the friendly name of your subscription, if not using the free trial
    $CloudServiceName = $domainCloudService
    $ServiceName = $domainCloudService
    $Name = $firstDC


    @@ -77,7 +79,7 @@ $Name = $firstDC
    #-------------------------------------------------

    #Connect Remotely to first DC
    $uri = Get-AzureWinRMUri -ServiceName$domainCloudService -Name $firstDC
    $uri = Get-AzureWinRMUri -ServiceName $domainCloudService -Name $firstDC
    $cred = Get-Credential
    Enter-PSSession -ConnectionUri $uri -Credential $cred

    @@ -115,11 +117,11 @@ Get-AzureVm -ServiceName $domainCloudService -Name $secondDC | Set-AzureAvailabi
    #Edit these lines at line 70 within the InstallWinRMCertzureVM.ps1 that you downloaded.

    $subscriptionName = "Free Trial" #Replace with the friendly name of your subscription, if not using the free trial
    $CloudServiceName = $domainCloudService
    $ServiceName = $domainCloudService
    $Name = $secondDC

    #Connect Remotely to second DC
    $uri = Get-AzureWinRMUri -ServiceName$domainCloudService -Name $secondDC
    $uri = Get-AzureWinRMUri -ServiceName $domainCloudService -Name $secondDC
    $cred = Get-Credential
    Enter-PSSession -ConnectionUri $uri -Credential $cred

  19. techbunny revised this gist Apr 20, 2015. No changes.
  20. techbunny revised this gist Apr 20, 2015. No changes.
  21. techbunny revised this gist Apr 20, 2015. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -56,7 +56,7 @@ $newVM = New-AzureVMConfig -Name $firstDC -InstanceSize $instancesize -Image $im
    New-AzureVM -VMs $newVM -ServiceName $domainCloudService -VNetName $VnetName

    #Move to Avail set
    Get-AzureVm -ServiceName SdomainCloudService -Name $firstDC | Set-AzureAvailabilitySet -AvailabilitySetName $dcAvalSet | Update-AzureVM
    Get-AzureVm -ServiceName $domainCloudService -Name $firstDC | Set-AzureAvailabilitySet -AvailabilitySetName $dcAvalSet | Update-AzureVM

    #-----------------------------------------------
    #Lab 2: Building Workloads
    @@ -102,8 +102,8 @@ New-ADUser –Name “Karen Vogue” -Path "OU=sales,dc=contosozaure,dc=com" -Sa
    #Section: Deploy the 2nd Domain Controller for your Forest
    #-------------------------------------------------

    $newVM = New-AzureVMConfig -Name $secondDC -InstanceSize $instancesize -Image $image '
    | Add-AzureProvisioningConfig -Windows -Password $pwd -AdminUsername $un '
    $newVM = New-AzureVMConfig -Name $secondDC -InstanceSize $instancesize -Image $image `
    | Add-AzureProvisioningConfig -Windows -Password $pwd -AdminUsername $un `
    | Set-AzureSubnet -SubnetNames $subnet

    New-AzureVM -VMs $newVM -ServiceName $domainCloudService
    @@ -123,7 +123,7 @@ $uri = Get-AzureWinRMUri -ServiceName$domainCloudService -Name $secondDC
    $cred = Get-Credential
    Enter-PSSession -ConnectionUri $uri -Credential $cred

    Add-WindowsFeature -name ad-domain-services IncludeManagementTools
    Add-WindowsFeature -name ad-domain-services -IncludeManagementTools

    Install-ADDSDomainController -Credential (Get-Credential) -DatabasePath 'C:\Windows\NTDS' -DomainName 'contosoazure.com' -InstallDns:$true -LogPath 'C:\Windows\NTDS' -NoGlobalCatalog:$false -SiteName 'Default-First-Site-Name' -SysvolPath 'C:\Windows\SYSVOL' -NoRebootOnCompletion:$true -Force:$true -Verbose

  22. techbunny revised this gist Apr 20, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,7 @@ $locationName = "West US"
    $domainCloudService = "ABCdomainservice"
    $dcAvalSet = "ABC-DCSet"

    $image = "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201411.01-en.us-127GB.vhd"
    $image = "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201502.01-en.us-127GB.vhd"
    $subnet = "Core-Subnet"
    $instancesize = "Small"
    $VnetName = "ABC-Vnet"
  23. techbunny revised this gist Apr 8, 2015. 1 changed file with 41 additions and 7 deletions.
    48 changes: 41 additions & 7 deletions ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,15 @@
    #Connect to your Azure Account
    #-----------------------------------------------
    #Lab 1: Building the Foundation
    #Section: Connect to Azure with Powershell
    #----------------------------------------------

    Add-AzureAccount
    Get-AzureSubscription

    #-------------------------------------------------
    #Set Your Variables for the Lab - Setting the Variables here will ensure the script will work for your environment. Replace "ABC" with your initials or something unique for your deployment.
    #-------------------------------------------------

    $subscriptionName = "Free Trial" #Replace with the friendly name of your subscription, if not using the free trial
    $storageAccountName = "abcstore" #storage name must be all lowercase
    $locationName = "West US"
    @@ -21,14 +28,27 @@ $secondDC = "ABC-DC02"
    #Select the subscription to use for the lab (important if you have more than one subscription in your account)
    Select-AzureSubscription -default -subscriptionName $subscriptionName

    #Create Storage Account
    #-----------------------------------------------
    #Lab 1: Building the Foundation
    #Section: Create a new storage account using PowerShell
    #----------------------------------------------

    New-AzureStorageAccount -StorageAccountName $storageAccountName -Location $locationName

    #Create Cloud Service
    #-----------------------------------------------
    #Lab 1: Building the Foundation
    #Section: Create a new service with PowerShell
    #----------------------------------------------

    Set-AzureSubscription -subscriptionName $subscriptionName -CurrentStorageAccount $storageAccountName
    New-AzureService -ServiceName $domainCloudService -Location $locationName

    #Create First VM/DC"
    #-----------------------------------------------
    #Lab 2: Building Workloads
    #Section: Deploy domain controllers in Microsoft Azure
    #Task: Create First VM/DC in the domain
    #-------------------------------------------------

    $newVM = New-AzureVMConfig -Name $firstDC -InstanceSize $instancesize -Image $image `
    | Add-AzureProvisioningConfig -Windows -Password $pwd -AdminUsername $un `
    | Set-AzureSubnet -SubnetNames $subnet
    @@ -38,13 +58,24 @@ New-AzureVM -VMs $newVM -ServiceName $domainCloudService -VNetName $VnetName
    #Move to Avail set
    Get-AzureVm -ServiceName SdomainCloudService -Name $firstDC | Set-AzureAvailabilitySet -AvailabilitySetName $dcAvalSet | Update-AzureVM

    #-----------------------------------------------
    #Lab 2: Building Workloads
    #Section: Preparing to Remotely Connect to Azure Virtual Machines
    #-------------------------------------------------

    #Install Certificate for remote connection to first Domain Controller
    #Add these lines at line 70 within the InstallWinRMCertzureVM.ps1 that you downloaded.

    $subscriptionName = "Free Trial" #Replace with the friendly name of your subscription, if not using the free trial
    $CloudServiceName = $domainCloudService
    $Name = $firstDC


    #-----------------------------------------------
    #Lab 2: Building Workloads
    #Section: Create users in your Active Directory
    #-------------------------------------------------

    #Connect Remotely to first DC
    $uri = Get-AzureWinRMUri -ServiceName$domainCloudService -Name $firstDC
    $cred = Get-Credential
    @@ -54,8 +85,6 @@ Enter-PSSession -ConnectionUri $uri -Credential $cred
    Add-WindowsFeature -name ad-domain-services -IncludeManagementTools
    Install-ADDSForest -DomainName "contosoazure.com" -ForestMode 6 -DomainMode 6

    #Create some AD Users for later

    New-ADOrganizationalUnit –Name “FINANCE” –Path “DC=contosoazure, DC=Com”
    New-ADOrganizationalUnit –Name “IT” –Path “DC=contosoazure, DC=Com”
    New-ADOrganizationalUnit –Name “SALES” –Path “DC=contosoazure, DC=Com”
    @@ -67,7 +96,12 @@ New-ADUser –Name “Pat Holden” -SamAccountName "Pat Holden" -GivenName "Pat
    New-ADUser –Name “Dan Chun” -SamAccountName "Dan Chun" -GivenName "Dan" -Surname "Chun" -DisplayName "Dan Chun" –Department “Finance" -AccountPassword $newPassword
    New-ADUser –Name “Karen Vogue” -Path "OU=sales,dc=contosozaure,dc=com" -SamAccountName "KarenVogue" -GivenName "Karen" -Surname "Vogue" -DisplayName "Karen Vogue" –Department “Sales" -AccountPassword $newPassword

    #Building 2nd DC VM

    #-----------------------------------------------
    #Lab 2: Building Workloads
    #Section: Deploy the 2nd Domain Controller for your Forest
    #-------------------------------------------------

    $newVM = New-AzureVMConfig -Name $secondDC -InstanceSize $instancesize -Image $image '
    | Add-AzureProvisioningConfig -Windows -Password $pwd -AdminUsername $un '
    | Set-AzureSubnet -SubnetNames $subnet
  24. techbunny revised this gist Apr 2, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -67,7 +67,7 @@ New-ADUser –Name “Pat Holden” -SamAccountName "Pat Holden" -GivenName "Pat
    New-ADUser –Name “Dan Chun” -SamAccountName "Dan Chun" -GivenName "Dan" -Surname "Chun" -DisplayName "Dan Chun" –Department “Finance" -AccountPassword $newPassword
    New-ADUser –Name “Karen Vogue” -Path "OU=sales,dc=contosozaure,dc=com" -SamAccountName "KarenVogue" -GivenName "Karen" -Surname "Vogue" -DisplayName "Karen Vogue" –Department “Sales" -AccountPassword $newPassword

    #Building 2nd DC VN
    #Building 2nd DC VM
    $newVM = New-AzureVMConfig -Name $secondDC -InstanceSize $instancesize -Image $image '
    | Add-AzureProvisioningConfig -Windows -Password $pwd -AdminUsername $un '
    | Set-AzureSubnet -SubnetNames $subnet
  25. techbunny revised this gist Apr 2, 2015. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -68,7 +68,9 @@ New-ADUser –Name “Dan Chun” -SamAccountName "Dan Chun" -GivenName "Dan" -S
    New-ADUser –Name “Karen Vogue” -Path "OU=sales,dc=contosozaure,dc=com" -SamAccountName "KarenVogue" -GivenName "Karen" -Surname "Vogue" -DisplayName "Karen Vogue" –Department “Sales" -AccountPassword $newPassword

    #Building 2nd DC VN
    $newVM = New-AzureVMConfig -Name $secondDC -InstanceSize $instancesize -Image $image | Add-AzureProvisioningConfig -Windows -Password $pwd -AdminUsername $un | Set-AzureSubnet -SubnetNames $subnet
    $newVM = New-AzureVMConfig -Name $secondDC -InstanceSize $instancesize -Image $image '
    | Add-AzureProvisioningConfig -Windows -Password $pwd -AdminUsername $un '
    | Set-AzureSubnet -SubnetNames $subnet

    New-AzureVM -VMs $newVM -ServiceName $domainCloudService

  26. techbunny revised this gist Apr 2, 2015. 1 changed file with 1 addition and 6 deletions.
    7 changes: 1 addition & 6 deletions ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -38,9 +38,6 @@ New-AzureVM -VMs $newVM -ServiceName $domainCloudService -VNetName $VnetName
    #Move to Avail set
    Get-AzureVm -ServiceName SdomainCloudService -Name $firstDC | Set-AzureAvailabilitySet -AvailabilitySetName $dcAvalSet | Update-AzureVM

    #Open and Run Script
    "..\InstallWinRMCertAzureVM.ps1" -subscriptionName $SubscriptionName -CloudServiceName $domainCloudService -Name $firstDC

    #Install Certificate for remote connection to first Domain Controller
    #Add these lines at line 70 within the InstallWinRMCertzureVM.ps1 that you downloaded.

    @@ -71,9 +68,7 @@ New-ADUser –Name “Dan Chun” -SamAccountName "Dan Chun" -GivenName "Dan" -S
    New-ADUser –Name “Karen Vogue” -Path "OU=sales,dc=contosozaure,dc=com" -SamAccountName "KarenVogue" -GivenName "Karen" -Surname "Vogue" -DisplayName "Karen Vogue" –Department “Sales" -AccountPassword $newPassword

    #Building 2nd DC VN
    $newVM = New-AzureVMConfig -Name $secondDC -InstanceSize $instancesize -Image $image `
    | Add-AzureProvisioningConfig -Windows -Password $pwd -AdminUsername $un `
    | Set-AzureSubnet -SubnetNames $subnet
    $newVM = New-AzureVMConfig -Name $secondDC -InstanceSize $instancesize -Image $image | Add-AzureProvisioningConfig -Windows -Password $pwd -AdminUsername $un | Set-AzureSubnet -SubnetNames $subnet

    New-AzureVM -VMs $newVM -ServiceName $domainCloudService

  27. techbunny revised this gist Apr 2, 2015. 1 changed file with 13 additions and 14 deletions.
    27 changes: 13 additions & 14 deletions ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -38,14 +38,15 @@ New-AzureVM -VMs $newVM -ServiceName $domainCloudService -VNetName $VnetName
    #Move to Avail set
    Get-AzureVm -ServiceName SdomainCloudService -Name $firstDC | Set-AzureAvailabilitySet -AvailabilitySetName $dcAvalSet | Update-AzureVM

    #Open and Run Script
    "..\InstallWinRMCertAzureVM.ps1" -subscriptionName $SubscriptionName -CloudServiceName $domainCloudService -Name $firstDC

    #Install Certificate for remote connection to first Domain Controller
    #Reset variables here or not?? (need to test)
    $subscriptionName = "Free Trial" #Replace with the friendly name of your subscription, if not using the free trial
    $domainCloudService = "ABCdomainservice"
    $firstDC = "ABC-DC01"
    #Add these lines at line 70 within the InstallWinRMCertzureVM.ps1 that you downloaded.

    #Open and Run Script
    "C:\Downloads\InstallWinRMCertAzureVM.ps1" -subscriptionName $SubscriptionName -CloudServiceName $domainCloudService -Name $firstDC
    $subscriptionName = "Free Trial" #Replace with the friendly name of your subscription, if not using the free trial
    $CloudServiceName = $domainCloudService
    $Name = $firstDC

    #Connect Remotely to first DC
    $uri = Get-AzureWinRMUri -ServiceName$domainCloudService -Name $firstDC
    @@ -54,7 +55,7 @@ Enter-PSSession -ConnectionUri $uri -Credential $cred

    #After remote connection to domain controller is made:
    Add-WindowsFeature -name ad-domain-services -IncludeManagementTools
    Install-ADDSForest -DomainName "contosoazure.com" -ForestMode 5 -DomainMode 5
    Install-ADDSForest -DomainName "contosoazure.com" -ForestMode 6 -DomainMode 6

    #Create some AD Users for later

    @@ -67,7 +68,7 @@ New-ADUser -Name "Matt Deen" -Path "OU=FINANCE,dc=contosoazure,dc=com" -AccountP
    New-ADUser –Name “Bob Smith” -Path "OU=SALES,dc=contosoazure,dc=com" -SamAccountName "BobSmith" -GivenName "Bob" -Surname "Smith" -DisplayName "Bob Smith" –Department “Sales" -AccountPassword $newPassword
    New-ADUser –Name “Pat Holden” -SamAccountName "Pat Holden" -GivenName "Pat" -Surname "Holden" -DisplayName "Pat Holden" –Department “Finance" -AccountPassword $newPassword
    New-ADUser –Name “Dan Chun” -SamAccountName "Dan Chun" -GivenName "Dan" -Surname "Chun" -DisplayName "Dan Chun" –Department “Finance" -AccountPassword $newPassword
    New-ADUser –Name “Karen Vogue” -Path "OU=sales,dc=contosozaure,dc=com" -SamAccountName "Karen Vogue" -GivenName "Karen" -Surname "Vogue" -DisplayName "Karen Vogue" –Department “Sales" -AccountPassword $newPassword
    New-ADUser –Name “Karen Vogue” -Path "OU=sales,dc=contosozaure,dc=com" -SamAccountName "KarenVogue" -GivenName "Karen" -Surname "Vogue" -DisplayName "Karen Vogue" –Department “Sales" -AccountPassword $newPassword

    #Building 2nd DC VN
    $newVM = New-AzureVMConfig -Name $secondDC -InstanceSize $instancesize -Image $image `
    @@ -80,13 +81,11 @@ New-AzureVM -VMs $newVM -ServiceName $domainCloudService
    Get-AzureVm -ServiceName $domainCloudService -Name $secondDC | Set-AzureAvailabilitySet -AvailabilitySetName $dcAvalSet | Update-AzureVM

    #Install Certificate for remote connection to second Domain Controller
    #Reset variables here or not?? (need to test)
    $subscriptionName = "Free Trial" #Replace with the friendly name of your subscription, if not using the free trial
    $domainCloudService = "<ID>domainservice" #ex: ABCdomainservice
    $secondDC = "ABC-DC02"
    #Edit these lines at line 70 within the InstallWinRMCertzureVM.ps1 that you downloaded.

    #Open and Run Script
    "C:\Downloads\InstallWinRMCertAzureVM.ps1" -subscriptionName $SubscriptionName -CloudServiceName $domainCloudService -Name $secondDC
    $subscriptionName = "Free Trial" #Replace with the friendly name of your subscription, if not using the free trial
    $CloudServiceName = $domainCloudService
    $Name = $secondDC

    #Connect Remotely to second DC
    $uri = Get-AzureWinRMUri -ServiceName$domainCloudService -Name $secondDC
  28. techbunny revised this gist Apr 1, 2015. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -2,17 +2,17 @@
    Add-AzureAccount
    Get-AzureSubscription

    #Set Your Variables for the Lab - Setting the Variables here will ensure the script will work for your environment.
    #Set Your Variables for the Lab - Setting the Variables here will ensure the script will work for your environment. Replace "ABC" with your initials or something unique for your deployment.
    $subscriptionName = "Free Trial" #Replace with the friendly name of your subscription, if not using the free trial
    $storageAccountName = "abcstore" #storage name must be all lowercase
    $locationName = "West US"
    $domainCloudService = "<ID>domainservice" #ex: ABCdomainservice
    $domainCloudService = "ABCdomainservice"
    $dcAvalSet = "ABC-DCSet"

    $image = "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201411.01-en.us-127GB.vhd"
    $subnet = "Core-Subnet"
    $instancesize = "Small"
    $VnetName = "<ID>-Vnet" #ex: ABC-Vnet
    $VnetName = "ABC-Vnet"
    $un = "sysadmin"
    $pwd = "Passw0rd!"
    $firstDC = "ABC-DC01"
    @@ -41,7 +41,7 @@ Get-AzureVm -ServiceName SdomainCloudService -Name $firstDC | Set-AzureAvailabil
    #Install Certificate for remote connection to first Domain Controller
    #Reset variables here or not?? (need to test)
    $subscriptionName = "Free Trial" #Replace with the friendly name of your subscription, if not using the free trial
    $domainCloudService = "<ID>domainservice" #ex: ABCdomainservice
    $domainCloudService = "ABCdomainservice"
    $firstDC = "ABC-DC01"

    #Open and Run Script
  29. techbunny revised this gist Apr 1, 2015. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -39,6 +39,7 @@ New-AzureVM -VMs $newVM -ServiceName $domainCloudService -VNetName $VnetName
    Get-AzureVm -ServiceName SdomainCloudService -Name $firstDC | Set-AzureAvailabilitySet -AvailabilitySetName $dcAvalSet | Update-AzureVM

    #Install Certificate for remote connection to first Domain Controller
    #Reset variables here or not?? (need to test)
    $subscriptionName = "Free Trial" #Replace with the friendly name of your subscription, if not using the free trial
    $domainCloudService = "<ID>domainservice" #ex: ABCdomainservice
    $firstDC = "ABC-DC01"
    @@ -79,6 +80,7 @@ New-AzureVM -VMs $newVM -ServiceName $domainCloudService
    Get-AzureVm -ServiceName $domainCloudService -Name $secondDC | Set-AzureAvailabilitySet -AvailabilitySetName $dcAvalSet | Update-AzureVM

    #Install Certificate for remote connection to second Domain Controller
    #Reset variables here or not?? (need to test)
    $subscriptionName = "Free Trial" #Replace with the friendly name of your subscription, if not using the free trial
    $domainCloudService = "<ID>domainservice" #ex: ABCdomainservice
    $secondDC = "ABC-DC02"
  30. techbunny revised this gist Apr 1, 2015. 1 changed file with 53 additions and 60 deletions.
    113 changes: 53 additions & 60 deletions ITCamp_Labs1-3
    Original file line number Diff line number Diff line change
    @@ -1,106 +1,99 @@
    #Connect to your Azure Account
    Add-AzureAccount

    Get-AzureSubscription

    $subscriptionName = "Internal Consumption"
    #Set Your Variables for the Lab - Setting the Variables here will ensure the script will work for your environment.
    $subscriptionName = "Free Trial" #Replace with the friendly name of your subscription, if not using the free trial
    $storageAccountName = "abcstore" #storage name must be all lowercase
    $locationName = "West US"
    $domainCloudService = "<ID>domainservice" #ex: ABCdomainservice
    $dcAvalSet = "ABC-DCSet"

    $image = "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201411.01-en.us-127GB.vhd"
    $subnet = "Core-Subnet"
    $instancesize = "Small"
    $VnetName = "<ID>-Vnet" #ex: ABC-Vnet
    $un = "sysadmin"
    $pwd = "Passw0rd!"
    $firstDC = "ABC-DC01"
    $secondDC = "ABC-DC02"

    #Select the subscription to use for the lab (important if you have more than one subscription in your account)
    Select-AzureSubscription -default -subscriptionName $subscriptionName

    #Create Storage Account

    $storageAccountName = "vpcstore"
    $locationName = "West US"
    New-AzureStorageAccount -StorageAccountName $storageAccountName -Location $locationName


    #Create Cloud Service
    Set-AzureSubscription -subscriptionName $subscriptionName -CurrentStorageAccount $storageAccountName
    New-AzureService -ServiceName "VPCdomainservice" -Location "West US"
    New-AzureService -ServiceName $domainCloudService -Location $locationName

    #Create First VM/DC"

    $image = "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201411.01-en.us-127GB.vhd"
    $subnet = "Core-Subnet"
    $instancesize = "Small"
    $VnetName = "VPC-Vnet"
    $un = "sysadmin"
    $pwd = "Passw0rd!"

    $newVM = New-AzureVMConfig -Name "VPC-DC01" -InstanceSize $instancesize -Image $image `
    $newVM = New-AzureVMConfig -Name $firstDC -InstanceSize $instancesize -Image $image `
    | Add-AzureProvisioningConfig -Windows -Password $pwd -AdminUsername $un `
    | Set-AzureSubnet -SubnetNames $subnet

    New-AzureVM -VMs $newVM -ServiceName "VPCdomainservice" -VNetName $VnetName
    New-AzureVM -VMs $newVM -ServiceName $domainCloudService -VNetName $VnetName

    #Move to Avail set
    Get-AzureVm -ServiceName "VPCdomainservice" -Name "VPC-DC01" | Set-AzureAvailabilitySet -AvailabilitySetName "VPC-DCSet" | Update-AzureVM
    Get-AzureVm -ServiceName SdomainCloudService -Name $firstDC | Set-AzureAvailabilitySet -AvailabilitySetName $dcAvalSet | Update-AzureVM

    $SubscriptionName = "Internal Consumption"
    $CloudServicename = "VPCdomainservice"
    $Name = "VPC-DC01"
    #Install Certificate for remote connection to first Domain Controller
    $subscriptionName = "Free Trial" #Replace with the friendly name of your subscription, if not using the free trial
    $domainCloudService = "<ID>domainservice" #ex: ABCdomainservice
    $firstDC = "ABC-DC01"

    #Open and Run Script
    "C:\Downloads\InstallWinRMCertAzureVM.ps1" -subscriptionName $SubscriptionName -CloudServiceName $CloudServiceName -Name $Name
    "C:\Downloads\InstallWinRMCertAzureVM.ps1" -subscriptionName $SubscriptionName -CloudServiceName $domainCloudService -Name $firstDC

    $uri = Get-AzureWinRMUri -ServiceName $cloudServiceName -Name $Name
    #Connect Remotely to first DC
    $uri = Get-AzureWinRMUri -ServiceName$domainCloudService -Name $firstDC
    $cred = Get-Credential
    Enter-PSSession -ConnectionUri $uri -Credential $cred

    #Now on Specific VM
    #After remote connection to domain controller is made:
    Add-WindowsFeature -name ad-domain-services -IncludeManagementTools
    Install-ADDSForest -DomainName "contosoazure.com" -ForestMode 5 -DomainMode 5

    Remove-WindowsFeature -name User-Interfaces-Infra

    #Create some AD Users for later

    New-ADOrganizationalUnit –Name “FINANCE” –Path “DC=contosoazure, DC=Com”
    New-ADOrganizationalUnit –Name “IT” –Path “DC=contosoazure, DC=Com”
    New-ADOrganizationalUnit –Name “SALES” –Path “DC=contosoazure, DC=Com”
    $newPassword = (Read-Host -Prompt "Provide New Password" -AsSecureString)

    #Building 2nd VM
    $image = "a699494373c04fc0bc8f2bb1389d6106__Windows-Server-2012-R2-201411.01-en.us-127GB.vhd"
    $subnet = "Core-Subnet"
    $instancesize = "Small"
    $VnetName = "VPC-Vnet"
    $un = "sysadmin"
    $pwd = "Passw0rd!"
    New-ADUser -Name "Matt Deen" -Path "OU=FINANCE,dc=contosoazure,dc=com" -AccountPassword $newPassword -Department "Finance" -SamAccountName "MattDeen" -Surname "Deen" -GivenName "Matt" -DisplayName "Matt Deen"
    New-ADUser –Name “Bob Smith” -Path "OU=SALES,dc=contosoazure,dc=com" -SamAccountName "BobSmith" -GivenName "Bob" -Surname "Smith" -DisplayName "Bob Smith" –Department “Sales" -AccountPassword $newPassword
    New-ADUser –Name “Pat Holden” -SamAccountName "Pat Holden" -GivenName "Pat" -Surname "Holden" -DisplayName "Pat Holden" –Department “Finance" -AccountPassword $newPassword
    New-ADUser –Name “Dan Chun” -SamAccountName "Dan Chun" -GivenName "Dan" -Surname "Chun" -DisplayName "Dan Chun" –Department “Finance" -AccountPassword $newPassword
    New-ADUser –Name “Karen Vogue” -Path "OU=sales,dc=contosozaure,dc=com" -SamAccountName "Karen Vogue" -GivenName "Karen" -Surname "Vogue" -DisplayName "Karen Vogue" –Department “Sales" -AccountPassword $newPassword

    $newVM = New-AzureVMConfig -Name "VPC-DC02" -InstanceSize $instancesize -Image $image `
    #Building 2nd DC VN
    $newVM = New-AzureVMConfig -Name $secondDC -InstanceSize $instancesize -Image $image `
    | Add-AzureProvisioningConfig -Windows -Password $pwd -AdminUsername $un `
    | Set-AzureSubnet -SubnetNames $subnet

    New-AzureVM -VMs $newVM -ServiceName "VPCdomainservice"
    New-AzureVM -VMs $newVM -ServiceName $domainCloudService

    #Move 2nd DC to Avail set
    Get-AzureVm -ServiceName "VPCdomainservice" -Name "VPC-DC02" | Set-AzureAvailabilitySet -AvailabilitySetName "VPC-DCSet" | Update-AzureVM

    Get-AzureVm -ServiceName $domainCloudService -Name $secondDC | Set-AzureAvailabilitySet -AvailabilitySetName $dcAvalSet | Update-AzureVM

    $SubscriptionName = "Internal Consumption"
    $CloudServicename = "VPCdomainservice"
    $Name = "VPC-DC02"
    #Install Certificate for remote connection to second Domain Controller
    $subscriptionName = "Free Trial" #Replace with the friendly name of your subscription, if not using the free trial
    $domainCloudService = "<ID>domainservice" #ex: ABCdomainservice
    $secondDC = "ABC-DC02"

    #Open and Run Script
    "C:\Downloads\InstallWinRMCertAzureVM.ps1" -subscriptionName $SubscriptionName -CloudServiceName $CloudServiceName -Name $Name
    "C:\Downloads\InstallWinRMCertAzureVM.ps1" -subscriptionName $SubscriptionName -CloudServiceName $domainCloudService -Name $secondDC

    $uri = Get-AzureWinRMUri -ServiceName $cloudServiceName -Name $Name
    #Connect Remotely to second DC
    $uri = Get-AzureWinRMUri -ServiceName$domainCloudService -Name $secondDC
    $cred = Get-Credential

    Enter-PSSession -ConnectionUri $uri -Credential $cred

    Add-WindowsFeature -name ad-domain-services –IncludeManagementTools

    Install-ADDSDomainController -Credential (Get-Credential) -DatabasePath 'C:\Windows\NTDS' -DomainName 'contosoazure.com' -InstallDns:$true -LogPath 'C:\Windows\NTDS' -NoGlobalCatalog:$false -SiteName 'Default-First-Site-Name' -SysvolPath 'C:\Windows\SYSVOL' -NoRebootOnCompletion:$true -Force:$true -Verbose

    #Create some AD Users for later

    New-ADOrganizationalUnit –Name “FINANCE” –Path “DC=contosoazure, DC=Com”
    New-ADOrganizationalUnit –Name “IT” –Path “DC=contosoazure, DC=Com”
    New-ADOrganizationalUnit –Name “SALES” –Path “DC=contosoazure, DC=Com”

    $newPassword = (Read-Host -Prompt "Provide New Password" -AsSecureString)

    New-ADUser -Name "Matt Deen" -Path "OU=FINANCE,dc=contosoazure,dc=com" -AccountPassword $newPassword -Department "Finance" -SamAccountName "MattDeen" -Surname "Deen" -GivenName "Matt" -DisplayName "Matt Deen"

    New-ADUser –Name “Bob Smith” -Path "OU=SALES,dc=contosoazure,dc=com" -SamAccountName "BobSmith" -GivenName "Bob" -Surname "Smith" -DisplayName "Bob Smith" –Department “Sales" -AccountPassword $newPassword

    New-ADUser –Name “Pat Holden” -SamAccountName "Pat Holden" -GivenName "Pat" -Surname "Holden" -DisplayName "Pat Holden" –Department “Finance" -AccountPassword $newPassword

    New-ADUser –Name “Dan Chun” -SamAccountName "Dan Chun" -GivenName "Dan" -Surname "Chun" -DisplayName "Dan Chun" –Department “Finance" -AccountPassword $newPassword

    New-ADUser –Name “Karen Vogue” -Path "OU=sales,dc=contosozaure,dc=com" -SamAccountName "Karen Vogue" -GivenName "Karen" -Surname "Vogue" -DisplayName "Karen Vogue" –Department “Sales" -AccountPassword $newPassword
    #Switch the 2nd Domain Controller to Server Core
    Remove-WindowsFeature -name User-Interfaces-Infra