チュートリアル:Active Directory の基本的な環境
このチュートリアルでは、Active Directory の基本的な環境を作成する手順について説明します。
チュートリアルで作成した環境を使用して、ハイブリッド ID シナリオのさまざまな側面をテストし、いくつかのチュートリアルの前提条件となります。 既存の Active Directory 環境がある場合は、代替として使用できます。 この情報は、新しく開始するユーザーのために提供されています。
このチュートリアルは次のもので構成されます。
前提条件
このチュートリアルを完了するために必要な前提条件を次に示します。
- Hyper-V がインストールされたコンピューター。 これは、Windows 10 または Windows Server 2016 コンピューターで行うことをお勧めします。
- 仮想マシンがインターネットで通信できるようにするための外部ネットワーク アダプター。
- Azure サブスクリプション
- Windows Server 2016 のコピー
- Microsoft .NET framework 4.7.1
注意
最短時間でチュートリアル環境を作成できるよう、このチュートリアルでは PowerShell スクリプトを使用します。 各スクリプトでは、その先頭で宣言された変数が使用されます。 変数はお客様の環境に合わせて変更することができ、そうする必要があります。
使用されるスクリプトでは、Microsoft Entra Connect クラウド プロビジョニング エージェントのインストール前に一般的な Active Directory 環境が作成されます。 これらはすべてのチュートリアルに関連しています。
このチュートリアルで使用される PowerShell スクリプトのコピーは、こちらの GitHub で入手できます。
仮想マシンの作成
ハイブリッド ID 環境を稼働させるには、まず、オンプレミスの Active Directory サーバーとして使用される仮想マシンを作成する必要があります。 次の操作を行います。
PowerShell ISE を管理者として起動します。
次のスクリプトを実行します。
#Declare variables $VMName = 'DC1' $Switch = 'External' $InstallMedia = 'D:\ISO\en_windows_server_2016_updated_feb_2018_x64_dvd_11636692.iso' $Path = 'D:\VM' $VHDPath = 'D:\VM\DC1\DC1.vhdx' $VHDSize = '64424509440' #Create New Virtual Machine New-VM -Name $VMName -MemoryStartupBytes 16GB -BootDevice VHD -Path $Path -NewVHDPath $VHDPath -NewVHDSizeBytes $VHDSize -Generation 2 -Switch $Switch #Set the memory to be non-dynamic Set-VMMemory $VMName -DynamicMemoryEnabled $false #Add DVD Drive to Virtual Machine Add-VMDvdDrive -VMName $VMName -ControllerNumber 0 -ControllerLocation 1 -Path $InstallMedia #Mount Installation Media $DVDDrive = Get-VMDvdDrive -VMName $VMName #Configure Virtual Machine to Boot from DVD Set-VMFirmware -VMName $VMName -FirstBootDevice $DVDDrive
オペレーティング システムの展開を完了する
仮想マシンの作成を完了するには、オペレーティング システムのインストールを完了する必要があります。
- Hyper-V マネージャーで仮想マシンをダブルクリックします。
- [スタート] ボタンをクリックします。
- "CD または DVD からブートするには、いずれかのキーを押してください" というメッセージが表示されます。 キーを押して続行します。
- Windows Server の起動画面で言語を選択し、 [次へ] をクリックします。
- [今すぐインストール] をクリックします。
- ライセンス キーを入力し、 [次へ] をクリックします。
- [ライセンス条項に同意します] をオンにし、 [次へ] をクリックします。
- [カスタム: Windows のみをインストールする (詳細設定)] を選択します
- [次へ] をクリックします。
- インストールが完了したら、仮想マシンを再起動してサインインし、Windows の更新プログラムを実行して VM を最新の状態にします。 最新の更新プログラムをインストールします。
Active Directory の前提条件をインストールする
仮想マシンを稼働させたところで、Active Directory のインストール前にいくつかの作業を行う必要があります。 言い換えると、仮想マシンの名前を変更し、静的 IP アドレスと DNS 情報を設定して、リモート サーバー管理ツールをインストールする必要があります。 次の操作を行います。
PowerShell ISE を管理者として起動します。
次のスクリプトを実行します。
#Declare variables $ipaddress = "10.0.1.117" $ipprefix = "24" $ipgw = "10.0.1.1" $ipdns = "10.0.1.117" $ipdns2 = "8.8.8.8" $ipif = (Get-NetAdapter).ifIndex $featureLogPath = "c:\poshlog\featurelog.txt" $newname = "DC1" $addsTools = "RSAT-AD-Tools" #Set static IP address New-NetIPAddress -IPAddress $ipaddress -PrefixLength $ipprefix -InterfaceIndex $ipif -DefaultGateway $ipgw # Set the DNS servers Set-DnsClientServerAddress -InterfaceIndex $ipif -ServerAddresses ($ipdns, $ipdns2) #Rename the computer Rename-Computer -NewName $newname -force #Install features New-Item $featureLogPath -ItemType file -Force Add-WindowsFeature $addsTools Get-WindowsFeature | Where installed >>$featureLogPath #Restart the computer Restart-Computer
Windows Server AD 環境を作成する
VM を作成して、名前の変更と静的 IP アドレスの設定を行いました。これで、Active Directory Domain Services のインストールと構成に進むことができます。 次の操作を行います。
PowerShell ISE を管理者として起動します。
次のスクリプトを実行します。
#Declare variables $DatabasePath = "c:\windows\NTDS" $DomainMode = "WinThreshold" $DomainName = "contoso.com" $DomaninNetBIOSName = "CONTOSO" $ForestMode = "WinThreshold" $LogPath = "c:\windows\NTDS" $SysVolPath = "c:\windows\SYSVOL" $featureLogPath = "c:\poshlog\featurelog.txt" $Password = "Pass1w0rd" $SecureString = ConvertTo-SecureString $Password -AsPlainText -Force #Install AD DS, DNS and GPMC start-job -Name addFeature -ScriptBlock { Add-WindowsFeature -Name "ad-domain-services" -IncludeAllSubFeature -IncludeManagementTools Add-WindowsFeature -Name "dns" -IncludeAllSubFeature -IncludeManagementTools Add-WindowsFeature -Name "gpmc" -IncludeAllSubFeature -IncludeManagementTools } Wait-Job -Name addFeature Get-WindowsFeature | Where installed >>$featureLogPath #Create New AD Forest Install-ADDSForest -CreateDnsDelegation:$false -DatabasePath $DatabasePath -DomainMode $DomainMode -DomainName $DomainName -SafeModeAdministratorPassword $SecureString -DomainNetbiosName $DomainNetBIOSName -ForestMode $ForestMode -InstallDns:$true -LogPath $LogPath -NoRebootOnCompletion:$false -SysvolPath $SysVolPath -Force:$true
Windows Server AD ユーザーを作成する
Active Directory 環境を作成したところで、テスト アカウントが必要になります。 このアカウントは、オンプレミスの AD 環境で作成されてから Microsoft Entra ID に同期されます。 次の操作を行います。
PowerShell ISE を管理者として起動します。
次のスクリプトを実行します。
# Filename: 4_CreateUser.ps1 # Description: Creates a user in Active Directory. This is part of # the Azure AD Connect password hash sync tutorial. # # DISCLAIMER: # Copyright (c) Microsoft Corporation. All rights reserved. This # script is made available to you without any express, implied or # statutory warranty, not even the implied warranty of # merchantability or fitness for a particular purpose, or the # warranty of title or non-infringement. The entire risk of the # use or the results from the use of this script remains with you. # # # # #Declare variables $Givenname = "Allie" $Surname = "McCray" $Displayname = "Allie McCray" $Name = "amccray" $Password = "Pass1w0rd" $Identity = "CN=ammccray,CN=Users,DC=contoso,DC=com" $SecureString = ConvertTo-SecureString $Password -AsPlainText -Force #Create the user New-ADUser -Name $Name -GivenName $Givenname -Surname $Surname -DisplayName $Displayname -AccountPassword $SecureString #Set the password to never expire Set-ADUser -Identity $Identity -PasswordNeverExpires $true -ChangePasswordAtLogon $false -Enabled $true
Microsoft Entra テストを作成する
ヒント
この記事の手順は、開始するポータルによって若干異なる場合があります。
次に、ユーザーをクラウドに同期できるよう、Microsoft Entra テナントを作成する必要があります。 新しい Microsoft Entra テナントを作成するには、次の操作を行います。
- Microsoft Entra 管理センターにサインインし、Microsoft Entra サブスクリプションのあるアカウントでサインインします。
- [Overview] をクリックします。
- [テナントを管理する] をクリックします。
- [作成]
を選択します。 - 組織の名前と初期ドメイン名を入力します。 [作成] を選択します。 これにより、ディレクトリが作成されます。
- これが完了したら、こちらのリンクをクリックし、ディレクトリを管理します。
Microsoft Entra ID にグローバル管理者を作成する
Microsoft Entra テナントができたので、次にグローバル管理者アカウントを作成します。 全体管理者アカウントを作成するには、以下を実行します。
- [管理] で、[ユーザー] を選択します。
- [すべてのユーザー] を選択し、 + [新しいユーザー] を選択します。
- このユーザーの名前およびユーザー名を入力します。 これがテナントのグローバル管理者になります。 また、[ディレクトリ ロール] を [グローバル管理者] に変更します。一時パスワードを表示することもできます。 完了したら、[作成] を選択します。
- これが完了したら、新しい Web ブラウザーを開き、新しい全体管理者アカウントと一時パスワードを使用して myapps.microsoft.com にサインインします。
- 全体管理者のパスワードを覚えやすいものに変更します。
省略可能: その他のサーバーとフォレスト
次に示すのは、追加のサーバーまたはフォレストを作成する手順を説明するオプションのセクションです。 これは、Microsoft Entra Connect クラウド同期のパイロットの実施など、より高度なチュートリアルで使用できます。
追加のサーバーのみが必要な場合は、仮想マシンの作成の手順で停止し、上記で作成した既存のドメインにサーバーを参加させることができます。
仮想マシンの作成
PowerShell ISE を管理者として起動します。
次のスクリプトを実行します。
# Filename: 1_CreateVM_CP.ps1 # Description: Creates a VM to be used in the tutorial. # # DISCLAIMER: # Copyright (c) Microsoft Corporation. All rights reserved. #This script is made available to you without any express, implied or statutory warranty, not even the implied warranty of merchantability or fitness for a particular purpose, or the warranty of title or non-infringement. The entire risk of the use or the results from the use of this script remains with you. # # # # #Declare variables $VMName = 'CP1' $Switch = 'External' $InstallMedia = 'D:\ISO\en_windows_server_2016_updated_feb_2018_x64_dvd_11636692.iso' $Path = 'D:\VM' $VHDPath = 'D:\VM\CP1\CP1.vhdx' $VHDSize = '64424509440' #Create New Virtual Machine New-VM -Name $VMName -MemoryStartupBytes 16GB -BootDevice VHD -Path $Path -NewVHDPath $VHDPath -NewVHDSizeBytes $VHDSize -Generation 2 -Switch $Switch #Set the memory to be non-dynamic Set-VMMemory $VMName -DynamicMemoryEnabled $false #Add DVD Drive to Virtual Machine Add-VMDvdDrive -VMName $VMName -ControllerNumber 0 -ControllerLocation 1 -Path $InstallMedia #Mount Installation Media $DVDDrive = Get-VMDvdDrive -VMName $VMName #Configure Virtual Machine to Boot from DVD Set-VMFirmware -VMName $VMName -FirstBootDevice $DVDDrive
オペレーティング システムの展開を完了する
仮想マシンの作成を完了するには、オペレーティング システムのインストールを完了する必要があります。
- Hyper-V マネージャーで仮想マシンをダブルクリックします。
- [スタート] ボタンをクリックします。
- "CD または DVD からブートするには、いずれかのキーを押してください" というメッセージが表示されます。 キーを押して続行します。
- Windows Server の起動画面で言語を選択し、 [次へ] をクリックします。
- [今すぐインストール] をクリックします。
- ライセンス キーを入力し、 [次へ] をクリックします。
- [ライセンス条項に同意します] をオンにし、 [次へ] をクリックします。
- [カスタム: Windows のみをインストールする (詳細設定)] を選択します
- [次へ] をクリックします。
- インストールが完了したら、仮想マシンを再起動してサインインし、Windows の更新プログラムを実行して VM を最新の状態にします。 最新の更新プログラムをインストールします。
Active Directory の前提条件をインストールする
仮想マシンを稼働させたところで、Active Directory のインストール前にいくつかの作業を行う必要があります。 言い換えると、仮想マシンの名前を変更し、静的 IP アドレスと DNS 情報を設定して、リモート サーバー管理ツールをインストールする必要があります。 次の操作を行います。
PowerShell ISE を管理者として起動します。
次のスクリプトを実行します。
# Filename: 2_ADPrep_CP.ps1 # Description: Prepares your environment for Active Directory. This is part of # the Azure AD Connect password hash sync tutorial. # # DISCLAIMER: # Copyright (c) Microsoft Corporation. All rights reserved. This # script is made available to you without any express, implied or # statutory warranty, not even the implied warranty of # merchantability or fitness for a particular purpose, or the # warranty of title or non-infringement. The entire risk of the # use or the results from the use of this script remains with you. # # # # #Declare variables $ipaddress = "10.0.1.118" $ipprefix = "24" $ipgw = "10.0.1.1" $ipdns = "10.0.1.118" $ipdns2 = "8.8.8.8" $ipif = (Get-NetAdapter).ifIndex $featureLogPath = "c:\poshlog\featurelog.txt" $newname = "CP1" $addsTools = "RSAT-AD-Tools" #Set static IP address New-NetIPAddress -IPAddress $ipaddress -PrefixLength $ipprefix -InterfaceIndex $ipif -DefaultGateway $ipgw #Set the DNS servers Set-DnsClientServerAddress -InterfaceIndex $ipif -ServerAddresses ($ipdns, $ipdns2) #Rename the computer Rename-Computer -NewName $newname -force #Install features New-Item $featureLogPath -ItemType file -Force Add-WindowsFeature $addsTools Get-WindowsFeature | Where installed >>$featureLogPath #Restart the computer Restart-Computer
Windows Server AD 環境を作成する
VM を作成して、名前の変更と静的 IP アドレスの設定を行いました。これで、Active Directory Domain Services のインストールと構成に進むことができます。 次の操作を行います。
PowerShell ISE を管理者として起動します。
次のスクリプトを実行します。
# Filename: 3_InstallAD_CP.ps1 # Description: Creates an on-premises AD environment. This is part of # the Azure AD Connect password hash sync tutorial. # # DISCLAIMER: # Copyright (c) Microsoft Corporation. All rights reserved. This # script is made available to you without any express, implied or # statutory warranty, not even the implied warranty of # merchantability or fitness for a particular purpose, or the # warranty of title or non-infringement. The entire risk of the # use or the results from the use of this script remains with you. # # # # #Declare variables $DatabasePath = "c:\windows\NTDS" $DomainMode = "WinThreshold" $DomainName = "fabrikam.com" $DomaninNetBIOSName = "FABRIKAM" $ForestMode = "WinThreshold" $LogPath = "c:\windows\NTDS" $SysVolPath = "c:\windows\SYSVOL" $featureLogPath = "c:\poshlog\featurelog.txt" $Password = "Pass1w0rd" $SecureString = ConvertTo-SecureString $Password -AsPlainText -Force #Install AD DS, DNS and GPMC start-job -Name addFeature -ScriptBlock { Add-WindowsFeature -Name "ad-domain-services" -IncludeAllSubFeature -IncludeManagementTools Add-WindowsFeature -Name "dns" -IncludeAllSubFeature -IncludeManagementTools Add-WindowsFeature -Name "gpmc" -IncludeAllSubFeature -IncludeManagementTools } Wait-Job -Name addFeature Get-WindowsFeature | Where installed >>$featureLogPath #Create New AD Forest Install-ADDSForest -CreateDnsDelegation:$false -DatabasePath $DatabasePath -DomainMode $DomainMode -DomainName $DomainName -SafeModeAdministratorPassword $SecureString -DomainNetbiosName $DomainNetBIOSName -ForestMode $ForestMode -InstallDns:$true -LogPath $LogPath -NoRebootOnCompletion:$false -SysvolPath $SysVolPath -Force:$true
Windows Server AD ユーザーを作成する
Active Directory 環境を作成したところで、テスト アカウントが必要になります。 このアカウントは、オンプレミスの AD 環境で作成されてから Microsoft Entra ID に同期されます。 次の操作を行います。
PowerShell ISE を管理者として起動します。
次のスクリプトを実行します。
# Filename: 4_CreateUser_CP.ps1 # Description: Creates a user in Active Directory. This is part of # the Azure AD Connect password hash sync tutorial. # # DISCLAIMER: # Copyright (c) Microsoft Corporation. All rights reserved. This # script is made available to you without any express, implied or # statutory warranty, not even the implied warranty of # merchantability or fitness for a particular purpose, or the # warranty of title or non-infringement. The entire risk of the # use or the results from the use of this script remains with you. # # # # #Declare variables $Givenname = "Anna" $Surname = "Ringdal" $Displayname = "Anna Ringdal" $Name = "aringdal" $Password = "Pass1w0rd" $Identity = "CN=aringdal,CN=Users,DC=fabrikam,DC=com" $SecureString = ConvertTo-SecureString $Password -AsPlainText -Force #Create the user New-ADUser -Name $Name -GivenName $Givenname -Surname $Surname -DisplayName $Displayname -AccountPassword $SecureString #Set the password to never expire Set-ADUser -Identity $Identity -PasswordNeverExpires $true -ChangePasswordAtLogon $false -Enabled $true
まとめ
これで、既存のチュートリアルや、クラウド同期で提供される追加機能のテストに使用できる環境が用意されました。
次のステップ
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示