Question 54 — AZ-104 Case Study Set
Review the C# provisioning fragment in Paideffort's capacity-management application.
var vmName = requestedVmName;
azure.VirtualMachines.Define(vmName)
.WithRegion(Region.USEast)
.WithExistingResourceGroup("Paideffort-Production")
.WithExistingPrimaryNetworkInterface(networkInterface)
.WithLatestWindowsImage(
"MicrosoftWindowsServer",
"WindowsServer",
"2012-R2-Datacenter")
.WithAdminUsername("platformadmin")
.WithAdminPassword("Paideffort-Prod-Password")
.WithComputerName(vmName)
.WithSize(VirtualMachineSizeTypes.StandardDS1)
.Create();
Paideffort requires stronger credential practices while retaining programmatic VM provisioning. Which improvement most directly addresses the credential handling shown in this code? (Select one answer)
Remove the hardcoded administrator password and obtain the required credential securely at runtime instead of embedding it in application source.
Replace the Azure Client SDK with Azure CLI because command-line VM creation automatically makes administrator passwords non-sensitive.
Move the hardcoded password into the VM name so the application can reuse it without storing a separate credential variable.
Export the resulting VM as an ARM template because exported templates automatically eliminate credentials embedded in application code.
Correct answers
Remove the hardcoded administrator password and obtain the required credential securely at runtime instead of embedding it in application source.
Explanations
Correct Answer:
Remove the hardcoded administrator password and obtain the required credential securely at runtime instead of embedding it in application source.
Explanation:
Paideffort wants stronger credential practices, but the provisioning application embeds a production administrator password directly in source code. The Client SDK can remain appropriate for the application's complex provisioning logic, while credential acquisition should be separated from source code and handled securely.
Wrong Answers:
Replace the Azure Client SDK with Azure CLI because command-line VM creation automatically makes administrator passwords non-sensitive.
Changing the management interface does not automatically secure a password. Paideffort's application also requires complex programmatic provisioning logic, for which the Client SDK remains appropriate.
Move the hardcoded password into the VM name so the application can reuse it without storing a separate credential variable.
This would expose confidential data in an inappropriate resource property and would not provide secure credential management.
Export the resulting VM as an ARM template because exported templates automatically eliminate credentials embedded in application code.
Template export does not correct insecure credential handling already present in Paideffort's application source.