本ヘルプセンターは英語版を翻訳したものです。また、一部には翻訳ソフトウエアにより機械的に翻訳した内容が含まれます。翻訳については順次対応しておりますが、最新の情報になっていない場合があります。最新の情報は英語版のページでご確認ください。表示言語は、画面右上の言語名をクリックして切り替えられます。
本ヘルプセンターの一部の記事には外部リンクが含まれています。万一リンク切れなどお気づきの点がございましたら、お手数ですが弊社サポート窓口までご連絡ください。
Azure Virtual Machine Scale SetsとDeep Security
Azure Virtual Machine Scale Sets (VMSS) を使用すると、一連の同一の仮想マシンを配置して管理できます。仮想マシンの数は、設定可能なスケーリングルールに基づいて自動的に増加または減少します。詳細については、「Azure Virtual Machine Scale Sets とは」を参照してください。
Deep Security Agentが事前にインストールされ、事前有効化されている基本VMイメージを含めるようにVMSSを設定できます。VMSSがスケールアップすると、スケールセットの新しい仮想マシンインスタンスにAgentが自動的に含まれます。
AgentをVMSSに追加するには:
- 手順1: (推奨) AzureアカウントをDeep Security Managerに追加する
- 手順2: インストールスクリプトを準備する
- 手順3: カスタムスクリプト拡張機能を介してAgentをVMSSインスタンスに追加する
手順1: (推奨) AzureアカウントをDeep Security Managerに追加する
Deep Security ManagerにAzureアカウントを追加すると、そのアカウントで作成されたすべてのAzureインスタンスがDeep Security Managerにロードされ、 Computersの下に表示されます。インスタンスは、Agentがインストールされているかどうかに関係なく表示されます。Agentを含まないインスタンスの [ステータス] は [Agent です。インスタンスにAgentをインストールして有効化したら、[ステータス] は [管理対象 (オンライン)] に変更されます。
Azureアカウントを追加した後でスケールの設定が手動または自動でスケールアップされた場合、 Deep Securityは新しいAzureインスタンスを検出し、 Computersのリストに追加します。同様に、スケールセットがスケールダウンすると、インスタンスがビューから削除されます。このため、 Deep Security Managerは常に、使用可能なAzureインスタンスの現在のリストをスケールセットに表示します。
ただし、AzureアカウントをDeep Security Managerに追加せず、代わりに別の方法を使用して個々のAzureインスタンスを追加すると、 Deep Securityはスケールダウンを検出せず、存在しないAzureインスタンスをそのインスタンスから削除しません。リスト。Deep Security ManagerでAzure VMのリストが拡大するのを防ぐため、いつAzureインスタンスが常に使用可能であるかを常に表示するには、AzureアカウントをDeep Security Managerに追加することを強くお勧めします。
Azureアカウントの追加手順については、Deep SecurityへのMicrosoft Azureアカウントの追加を参照してください。
手順2: インストールスクリプトを準備する
Deep Security Managerで、 Deep Security ManagerからDeep Securityスクリプトを準備します。手順については、インストールスクリプトを使用したコンピュータの追加と保護を参照してください。このインストールスクリプトは、次に設定するカスタムスクリプト拡張機能で参照されます。
手順3: カスタムスクリプト拡張機能を介してAgentをVMSSインスタンスに追加する
次に、PowerShellを使用してAgentを追加する方法に関する例を示します。
両方の例:
- Add-AzureRmVmssExtension cmdletを使用して拡張機能をVMSSに追加します。
- Azure PowerShell 5.1.1を使用します。
PowerShell cmdletを使用して新しいVMSSを作成する手順については、このMicrosoftチュートリアルを参照してください。Linuxプラットフォームについては、https://github.com/Azure/custom-script-extension-linuxを参照してください。
例1: Agentを含む新しいVMSSを作成する
$resourceGroupName = <The resource group of the VMSS>
$vmssname = <The name of the VMSS>
# Create ResourceGroup
New-AzureRmResourceGroup -ResourceGroupName $resourceGroupName -Location EastUS
# Create a config object
$vmssConfig = New-AzureRmVmssConfig `
-Location EastUS `
-SkuCapacity 2 `
-SkuName Standard_DS2 `
-UpgradePolicyMode Automatic
# Define the script for your Custom Script Extension to run on the Windows Platform
$customConfig = @{
"fileUris" = (,"A URL of your copy of deployment script, ex. deploymentscript.ps1");
"commandToExecute" = "powershell -ExecutionPolicy Unrestricted -File deploymentscript.ps1"
}
# Define the script for your Custom Script Extension to run on the Linux Platform
#$customConfig = @{
# "fileUris" = (,"A URL of your copy of deployment script, ex. deploymentscript.sh");
# "commandToExecute" = "bash deploymentscript.sh"
#}
# The section is required only if deploymentscript has been located within Azure StorageAccount
$storageAccountName = <StorageAccountName if deploymentscript is locate in Azure Storage>
$key = (Get-AzureRmStorageAccountKey -Name $storageAccountName -ResourceGroupName $resourceGroupName).Value[0]
$protectedConfig = @{
"storageAccountName" = $storageAccountName;
"storageAccountKey" = $key
}
# Use Custom Script Extension to install Deep Security Agent (Windows)
Add-AzureRmVmssExtension -VirtualMachineScaleSet $vmssConfig `
-Name "customScript" `
-Publisher "Microsoft.Compute" `
-Type "CustomScriptExtension" `
-TypeHandlerVersion 1.8 `
-Setting $customConfig `
-ProtectedSetting $protectedConfig
# Use Custom Script Extension to install Deep Security Agent (Linux)
#Add-AzureRmVmssExtension -VirtualMachineScaleSet $vmssConfig `
# -Name "customScript" `
# -Publisher "Microsoft.Azure.Extensions" `
# -Type "customScript" `
# -TypeHandlerVersion 2.0 `
# -Setting $customConfig `
# -ProtectedSetting $protectedConfig
# Create a public IP address
# Create a frontend and backend IP pool
# Create the load balancer
# Create a load balancer health probe on port 80
# Create a load balancer rule to distribute traffic on port 80
# Update the load balancer configuration
# Reference a virtual machine image from the gallery
# Set up information for authenticating with the virtual machine
# Create the virtual network resources
# Attach the virtual network to the config object
# Create the scale set with the config object (this step might take a few minutes)
New-AzureRmVmss `
-ResourceGroupName $resourceGroupName `
-Name $vmssname `
-VirtualMachineScaleSet $vmssConfig
例2: 既存のVMSSにAgentを追加する
$resourceGroupName = <The resource group of the VMSS>
$vmssname = <The name of the VMSS>
# Get the VMSS model
$vmssobj = Get-AzureRmVmss -ResourceGroupName $resourceGroupName -VMScaleSetName $vmssname
# Show model data if you prefer
# Write-Output $vmssobj
# Define the script for your Custom Script Extension to run on the Windows platform
$customConfig = @{
"fileUris" = (,"A URL of your copy of deployment script, ex. deploymentscript.ps1");
"commandToExecute" = "powershell -ExecutionPolicy Unrestricted -File deploymentscript.ps1"
}
# Define the script for your Custom Script Extension to run on the Linux platform
#$customConfig = @{
# "fileUris" = (,"A URL of your copy of deployment script, ex. deploymentscript.sh");
# "commandToExecute" = "bash deploymentscript.sh"
#}
# The section is required only if deploymentscript has been located within Azure StorageAccount
$storageAccountName = <StorageAccountName if deploymentscript is locate in Azure Storage>
$key= (Get-AzureRmStorageAccountKey -Name $storageAccountName -ResourceGroupName $resourceGroupName).Value[0]
$protectedConfig = @{
"storageAccountName" = $storageAccountName;
"storageAccountKey" = $key
}
# Use Custom Script Extension to install Deep Security Agent (Windows)
$newvmssobj = Add-AzureRmVmssExtension `
-VirtualMachineScaleSet $vmssobj `
-Name "customScript" `
-Publisher "Microsoft.Compute" `
-Type "CustomScriptExtension" `
-TypeHandlerVersion 1.8 `
-Setting $customConfig `
-ProtectedSetting $protectedConfig
# Use Custom Script Extension to install Deep Security Agent (Linux)
#$newvmssobj = Add-AzureRmVmssExtension `
# -VirtualMachineScaleSet $vmssobj `
# -Name "customScript" `
# -Publisher "Microsoft.Azure.Extensions" `
# -Type "customScript" `
# -TypeHandlerVersion 2.0 `
# -Setting $customConfig `
# -ProtectedSetting $protectedConfig
# Update the virtual machine scale set model
Update-AzureRmVmss -ResourceGroupName $resourceGroupName -name $vmssname -VirtualMachineScaleSet $newvmssobj -Verbose
# Get Instance ID for all instances in this VMSS, and decide which instance you'd like to update
# Get-AzureRmVmssVM -ResourceGroupName $resourceGroupName -VMScaleSetName $vmssname
# Now start updating instances
# If upgradePolicy is Automatic in the VMSS, do NOT execute the next command Update-AzureRmVmssInstance. Azure will auto-update the VMSS.
# There's no PowerShell command to update all instances at once. But you could refer to the output of Update-AzureRmVmss, and loop all instances into this command.
Update-AzureRmVmssInstance -ResourceGroupName $resourceGroupName -VMScaleSetName $vmssname -InstanceId 0