AZ-303 Exam QuestionsBrowse all questions from this exam

AZ-303 Exam - Question 243


DRAG DROP -

You have an Azure virtual machine named VM1 that runs Windows Server 2016.

You install a line-to-business application on VM1.

You need to create an Azure virtual machine by using VM1 as a custom image.

Which three actions should you perform in sequence? To answer, move the appropriate actions from the list of actions to the answer area and arrange them in the correct order.

Select and Place:

Exam AZ-303 Question 243
Show Answer
Correct Answer:
Exam AZ-303 Question 243

Step 1: Run sysprep.exe on VM1.

If a template, or system image is used, System administrators must run the Sysprep tool to clear the SID information. The Sysprep tool is usually one of the last tasks performed by a system administrator when building a server image/template, that way each clone of the template will generalize a new unique SID for every server image copied from the template and will prepare the server for a first time boot.

The end result is a System template that functions as a new unique build every time it is deployed.

Step 2: From Azure CLI, deallocate VM1 and mark VM1 as generalized

To create an image, the VM needs to be deallocated. Deallocate the VM with Stop-AzVm. Then, set the state of the VM as generalized with Set-AzVm so that the

Azure platform knows the VM is ready for use a custom image

Step 3: Create a virtual machine scale set

Now create a scale set with New-AzVmss that uses the -ImageName parameter to define the custom VM image created in the previous step.

References:

https://thesolving.com/server-room/when-and-how-to-use-sysprep/ https://docs.microsoft.com/en-us/azure/virtual-machine-scale-sets/tutorial-use-custom-image-powershell

Discussion

9 comments
Sign in to comment
SAMBIT
Mar 28, 2021

1. Run sysprep.exe on VM 2. From Azure CLI, deallocate VM1 and mark VM1 as generalized (3. From the azure CLI run az vm create - but this option isn't available) 3. From Azure CLI, apply a custom script extension

a_r_c
May 3, 2021

Not sure i understand the context of custom script extension here..

tteesstt
Aug 31, 2021

You need to create VM not VMSS, the only reasonable answer left is "From Azure CLI, apply a custom script extension"

gizda2
Oct 6, 2021

True, but it doesn't answer what to do with that "custom script extension" here.

ScubaDiver123456
Dec 6, 2021

@tteesstt. You can create 0, 1 or 1000 VMs with a VMSS so it seems logical to me that you would create a VMSS after and specify the # of VMs desired with the custom image.

gizda2
Oct 6, 2021

True, but it doesn't answer what to do with that "custom script extension" here.

ScubaDiver123456
Dec 6, 2021

@tteesstt. You can create 0, 1 or 1000 VMs with a VMSS so it seems logical to me that you would create a VMSS after and specify the # of VMs desired with the custom image.

tteesstt
Aug 31, 2021

You need to create VM not VMSS, the only reasonable answer left is "From Azure CLI, apply a custom script extension"

gizda2
Oct 6, 2021

True, but it doesn't answer what to do with that "custom script extension" here.

ScubaDiver123456
Dec 6, 2021

@tteesstt. You can create 0, 1 or 1000 VMs with a VMSS so it seems logical to me that you would create a VMSS after and specify the # of VMs desired with the custom image.

gizda2
Oct 6, 2021

True, but it doesn't answer what to do with that "custom script extension" here.

ScubaDiver123456
Dec 6, 2021

@tteesstt. You can create 0, 1 or 1000 VMs with a VMSS so it seems logical to me that you would create a VMSS after and specify the # of VMs desired with the custom image.

ahorva
Jan 7, 2022

you cannot apply a custom script extension to a VM that is not running

SnakePlissken
May 29, 2021

This question is almost repeated in topic 5 question 104, but there you're asked to create a scale set. Then this answer makes sense. Maybe that this question is not correct. https://www.examtopics.com/exams/microsoft/az-303/view/47

gizda2
Oct 6, 2021

The point is here! The question itself must be mistyped/wrong.

itsamemario
Feb 26, 2021

Should be: 1. Run sysprep.exe on VM 2. From Azure CLI, deallocate VM1 and mark VM1 as generalized (3. From the azure CLI run az vm create - but this option isn't available) 3. From Azure CLI, apply a custom script extension See: https://docs.microsoft.com/en-us/learn/modules/deploy-vms-from-vhd-templates/4-exercise-create-image-provision-vm?pivots=windows-cloud

jank
Feb 28, 2021

Your argument for point 3 is incorrect: In the exercise your are referencing here, the custom extension is only used to update the servername in the webapp of the new VM. It is just a cosmetic thing, and not really needed. I agree "az vm create --image MyVMImage" would be a correct solution, but it is not offered here, so I think scale set is correct.

rdemontis
Jul 13, 2021

Exactly, even if it is not requested the only possible solution is to create a VMSS. Really you need to create only a VM but there isn't that option. Custom Script Extension is used for post deployment operation so it can't be correct. First you have to create the VM. https://docs.microsoft.com/en-us/azure/virtual-machines/extensions/custom-script-windows

rdemontis
Jul 13, 2021

Exactly, even if it is not requested the only possible solution is to create a VMSS. Really you need to create only a VM but there isn't that option. Custom Script Extension is used for post deployment operation so it can't be correct. First you have to create the VM. https://docs.microsoft.com/en-us/azure/virtual-machines/extensions/custom-script-windows

Blimpy
Jan 15, 2021

I think last step is to customise the name of the web server: az vm extension set \ --name CustomScriptExtension \ --vm-name CUSTOM-NAME\ --publisher Microsoft.Compute \ --settings '{"commandToExecute":"powershell Clear-Content -Path \"C:\\inetpub\\wwwroot\\Default.htm\"; Add-Content -Path \"C:\\inetpub\\wwwroot\\Default.htm\" -Value $(hostname)"}' Exercise here: https://docs.microsoft.com/en-us/learn/modules/deploy-vms-from-vhd-templates/4-exercise-create-image-provision-vm?pivots=windows-cloud

abadal
Jan 27, 2021

but this is just to show to the person who is doing the exercise that new machine created. not a mandatory steps.

razfallow
Jan 5, 2021

correct, the VM scale set is created using the custom image

Stevezzc
Jan 8, 2021

why do we need to create VMSS?

Niro
Jan 15, 2021

agree. it seems that the question is missing full context

ScubaDiver123456
Dec 6, 2021

@Stevezzc. You can create 0, 1 or 1000 VMs with a VMSS. The problem statement says the solution needs to create one VM from the custom image, so it seems logical to me that you would create a VMSS after and specify the # of VMs desired with the custom image.

Niro
Jan 15, 2021

agree. it seems that the question is missing full context

ScubaDiver123456
Dec 6, 2021

@Stevezzc. You can create 0, 1 or 1000 VMs with a VMSS. The problem statement says the solution needs to create one VM from the custom image, so it seems logical to me that you would create a VMSS after and specify the # of VMs desired with the custom image.

Stephan99
Jan 11, 2021

see also https://docs.microsoft.com/en-us/learn/modules/deploy-vms-from-vhd-templates/4-exercise-create-image-provision-vm?pivots=windows-cloud

Pinto
Jul 23, 2021

repeat topic 1 Q73

altafpatel1984
Feb 12, 2022

But in that question had to create scale set, but here have to create virtual machine.

PJon
Oct 3, 2021

The given answer looks correct. As the images already had line of business application as part of image, the user of custom script looks redundant (what's the use of image if it's not complete). The question is to create a VM from image and in this scenario the VMSS fits the purpose.

Mj11Az
May 21, 2021

LB and VMSS doesn't make sense here so 3rd one will be custom script extention. 1. Run sysprep.exe on VM 2. From Azure CLI, deallocate VM1 and mark VM1 as generalized

tita_tovenaar
Jul 25, 2021

agree with your deduction. Question says clearly "you need to create *an Azure virtual machine* --> no scale set at all. Hence option 2 and 5 are out.