Coder Social home page Coder Social logo

miguel-flores69 / azure-devtestlab-activedirectoryjoin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from francedot/azure-devtestlab-activedirectoryjoin

1.0 0.0 1.0 254 KB

Home Page: https://azure.microsoft.com/en-us/services/lab-services/

License: MIT License

PowerShell 100.00%

azure-devtestlab-activedirectoryjoin's Introduction

Azure Lab Services - Active Directory Domain Join

These scripts can be used to join Lab Services VMs to an Active Directory Domain. VMs can be joined to:

  • On-premises AD Domains
  • Hybrid AD Domains: An on-prem AD which is connected to an Azure Active Directory through Azure AD Connect. AD Domain Services is installed on a on-prem server. Applies also to federated domains.
  • Azure AD DS Domains: For full-cloud AD (Azure AD + Azure AD DS) or Hybrid AD with secondary Domain Services on Azure.

Prerequisites

  1. 2 options:
  2. Peer the Lab Account with the connected VNet.
  3. Create a new Lab (Labs created prior to the VNet peering are not supported). Enable the option Use same password for all virtual machines.
  4. On the Template VM:
    • Install the Azure PowerShell Module
    • Connect to your Azure Account: Connect-AzAccount
    • Set the default subscription to the one of the Lab Account: Select-AzSubscription -SubscriptionID <SUB_ID>

Usage

From the Template VM:

$DomainServiceAddress = '<PRIMARY_DS_IP>','<SECONDARY_DS_IP>'
$Domain = "contosounilab.com"
$LocalUser = "localuser"
$DomainUser = "[email protected]"
$LocalPassword = "<LOCAL_PASSWORD>"
$DomainPassword = "<DOMAIN_PASSWORD>"

. ".\Join-AzLabADTemplate.ps1" `
    -DomainServiceAddress $DomainServiceAddress `
    -Domain $Domain `
    -LocalUser $LocalUser `
    -DomainUser $DomainUser `
    -LocalPassword $LocalPassword `
    -DomainPassword $DomainPassword `
    -EnrollMDM

Parameters

DomainServiceAddress

1 or more IP addresses of the Servers where AD DS is installed.

For on-prem AD DS Servers: On-prem AD DS

For Azure AD DS (PaaS): Azure AD DS (PaaS)

Domain

Name of the AD domain (e.g. contoso.com).

LocalUser

Local Account name for the Template VM (the one specified at Lab creation).

DomainUser

Domain Account name (e.g. CONTOSO\frbona or [email protected]). The account must have permissions to add computers to the AD domain.

LocalPassword

Local Account password for the Template VM (the one specified at Lab creation).

DomainPassword

Domain account password.

EnrollMDM

(Optional) Whether to enroll the VMs to Intune (for Hybrid AD only).

Template VM

Join-AzLabADTemplate

Main script to be run from the Template VM. It gets details on the currently running Template VM and Lab. It then schedules the scripts chain starting with Join-AzLabADStudent_RenameVm.ps1 and publishes the Lab.

Note: Only the Student VMs are domain-joined. Template VM is used to run the Join-AzLabADTemplate.ps1 script and trigger the next chain of scripts in the Student VMs.

Scripts Chain

Join-AzLabADStudent_RenameVm (step I)

Gets the details on the currently running Student VM and renames the computer with a unique name. It then schedules the startup script Join-AzLabADStudent_JoinVm.ps1 to run at next boot.

Join-AzLabADStudent_JoinVm (step II)

Updates the DNS settings based on the Domain Services address/es and performs the actual join of the computer to the domain. It then schedules the startup script Join-AzLabADStudent_AddStudent.ps1 to run at next boot.

Join-AzLabADStudent_AddStudent (step III)

Checks whether the VM has been claimed by a student and eventually adds the student to the local RDP group.

Join-AzLabADStudent_EnrollMDM (step IV)

Checks the device is Azure AD joined. If so, it enrolls the VM to Intune using the user AAD credentials.

Note: Applies only to Hybrid AD joined devices. Student must be assigned a valid Intune license. Other requirements for Intune can be found here.

Set-AzLabADVms (optional)

Optional script to be run from the Template VM. It spins up all the VMs leaving enough time for the domain join scripts to be executed before shutting down the VMs.

Utils.ps1

Utility functions and extensions to the Az.LabServices module.

Notes

  • The script currently supports only Windows 10.
  • The domain join happens at the first boot of the Student VM. Approximately 2-3 minutes are required for the scripts to execute.
  • Both unclaimed and claimed VMs are joined to the AD domain. For claimed VMs, students can use their university credentials. They can still use the local account credentials if professors provide those credentials.
  • At Lab creation, enabling the option Use same password for all virtual machines is preferable. This way, students are not prompted to pick a new password and can use straightaway their university credentials.

azure-devtestlab-activedirectoryjoin's People

Contributors

francedot avatar

Stargazers

 avatar

Forkers

empereon

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.