in e2etest/GuestProxyAgentTest/Utilities/VMBuilder.cs [91:178]
private async Task<VirtualMachineData> DoCreateVMData(ResourceGroupResource rgr, bool enableProxyAgent)
{
var vmData = new VirtualMachineData(TestSetting.Instance.location)
{
HardwareProfile = new VirtualMachineHardwareProfile()
{
VmSize = new VirtualMachineSizeType(TestSetting.Instance.vmSize),
},
StorageProfile = new VirtualMachineStorageProfile()
{
ImageReference = new ImageReference()
{
Publisher = this.testScenarioSetting.VMImageDetails.Publisher,
Offer = this.testScenarioSetting.VMImageDetails.Offer,
Sku = this.testScenarioSetting.VMImageDetails.Sku,
Version = this.testScenarioSetting.VMImageDetails.Version,
},
OSDisk = new VirtualMachineOSDisk(DiskCreateOptionType.FromImage)
{
Name = "e2eVmOsDisk",
Caching = CachingType.ReadWrite,
ManagedDisk = new VirtualMachineManagedDisk()
{
StorageAccountType = StorageAccountType.StandardLrs,
},
},
},
OSProfile = new VirtualMachineOSProfile()
{
ComputerName = vmName,
AdminUsername = this.adminUsername,
AdminPassword = this.adminPassword,
},
NetworkProfile = await DoCreateVMNetWorkProfile(rgr),
};
if (enableProxyAgent)
{
vmData.SecurityProfile = new SecurityProfile()
{
ProxyAgentSettings = new ProxyAgentSettings()
{
Enabled = true,
WireServer = new HostEndpointSettings()
{
InVmAccessControlProfileReferenceId = TestSetting.Instance.InVmWireServerAccessControlProfileReferenceId,
},
Imds = new HostEndpointSettings()
{
InVmAccessControlProfileReferenceId = TestSetting.Instance.InVmIMDSAccessControlProfileReferenceId,
},
}
};
}
if (Constants.IS_WINDOWS())
{
vmData.OSProfile.WindowsConfiguration = new WindowsConfiguration()
{
ProvisionVmAgent = true,
IsAutomaticUpdatesEnabled = true,
PatchSettings = new PatchSettings()
{
AssessmentMode = WindowsPatchAssessmentMode.ImageDefault,
},
};
}
else
{
vmData.OSProfile.LinuxConfiguration = new LinuxConfiguration()
{
//ProvisionVMAgent = true,
//IsPasswordAuthenticationDisabled = false,
};
}
if (PLAN_REQUIRED_IMAGES.Contains(this.testScenarioSetting.VMImageDetails.Publisher))
{
vmData.Plan = new ComputePlan()
{
Name = this.testScenarioSetting.VMImageDetails.Sku,
Publisher = this.testScenarioSetting.VMImageDetails.Publisher,
Product = this.testScenarioSetting.VMImageDetails.Offer,
};
}
return vmData;
}